diff --git a/gradle.properties b/gradle.properties index 944938715..aa6866da2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ use_parchment = true # dependency versions registrate_version = MC1.20-1.3.3 flywheel_minecraft_version = 1.20.1 -flywheel_version = 1.0.0-beta-103 +flywheel_version = 1.0.0-beta-104 jei_minecraft_version = 1.20.1 jei_version = 15.2.0.22 curios_minecraft_version = 1.20.1 diff --git a/src/main/java/com/simibubi/create/content/contraptions/pulley/AbstractPulleyVisual.java b/src/main/java/com/simibubi/create/content/contraptions/pulley/AbstractPulleyVisual.java index 395dce1fe..d5dd84a90 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/pulley/AbstractPulleyVisual.java +++ b/src/main/java/com/simibubi/create/content/contraptions/pulley/AbstractPulleyVisual.java @@ -36,7 +36,7 @@ public abstract class AbstractPulleyVisual extends protected final Direction rotatingAbout; protected final Axis rotationAxis; - private final LightCache lightCache = new LightCache(1); + private final LightCache lightCache = new LightCache(); private float offset; @@ -60,6 +60,12 @@ public abstract class AbstractPulleyVisual extends updateOffset(partialTick); } + @Override + public void setSectionCollector(SectionCollector sectionCollector) { + super.setSectionCollector(sectionCollector); + lightCache.updateSections(); + } + protected abstract Instancer getRopeModel(); protected abstract Instancer getMagnetModel(); @@ -172,16 +178,11 @@ public abstract class AbstractPulleyVisual extends } private class LightCache { - private final ByteList data; + private final ByteList data = new ByteArrayList(); private final LongSet sections = new LongOpenHashSet(); private final BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(); private int sectionCount; - public LightCache(int initialSize) { - data = new ByteArrayList(initialSize); - setSize(initialSize); - } - public void setSize(int size) { if (size != data.size()) { data.size(size); @@ -196,11 +197,18 @@ public abstract class AbstractPulleyVisual extends for (int i = 0; i < sectionCount; i++) { sections.add(SectionPos.asLong(sectionX, sectionY - i, sectionZ)); } - lightSections.sections(sections); + // Will be null during initialization + if (lightSections != null) { + updateSections(); + } } } } + public void updateSections() { + lightSections.sections(sections); + } + public void update() { mutablePos.set(pos); diff --git a/src/main/java/com/simibubi/create/content/kinetics/crank/HandCrankVisual.java b/src/main/java/com/simibubi/create/content/kinetics/crank/HandCrankVisual.java index 59d1b099e..1eebee84b 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/crank/HandCrankVisual.java +++ b/src/main/java/com/simibubi/create/content/kinetics/crank/HandCrankVisual.java @@ -59,6 +59,10 @@ public class HandCrankVisual extends KineticBlockEntityVisual