diff --git a/src/main/java/com/jozufozu/flywheel/api/instancer/InstancerFactory.java b/src/main/java/com/jozufozu/flywheel/api/instancer/InstancerFactory.java deleted file mode 100644 index d1005a207..000000000 --- a/src/main/java/com/jozufozu/flywheel/api/instancer/InstancerFactory.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.jozufozu.flywheel.api.instancer; - -import com.jozufozu.flywheel.core.model.Model; - -public interface InstancerFactory { - - /** - * Get an instancer for the given model. Calling this method twice with the same key will return the same instancer. - * - * @param modelKey An object that uniquely identifies and provides the model. - * @return An instancer for the given model, capable of rendering many copies for little cost. - */ - Instancer model(Model modelKey); - -} diff --git a/src/main/java/com/jozufozu/flywheel/api/instancer/InstancerManager.java b/src/main/java/com/jozufozu/flywheel/api/instancer/InstancerManager.java index 2078b9edd..52d7fd2e8 100644 --- a/src/main/java/com/jozufozu/flywheel/api/instancer/InstancerManager.java +++ b/src/main/java/com/jozufozu/flywheel/api/instancer/InstancerManager.java @@ -1,12 +1,18 @@ package com.jozufozu.flywheel.api.instancer; import com.jozufozu.flywheel.api.struct.StructType; +import com.jozufozu.flywheel.core.model.Model; import net.minecraft.core.Vec3i; public interface InstancerManager { - InstancerFactory factory(StructType type); + /** + * Get an instancer for the given struct type and model. Calling this method twice with the same arguments will return the same instancer. + * + * @return An instancer for the given struct type and model. + */ + Instancer instancer(StructType type, Model model); Vec3i getOriginCoordinate(); diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancerKey.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancerKey.java new file mode 100644 index 000000000..595ca0f4f --- /dev/null +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/InstancerKey.java @@ -0,0 +1,8 @@ +package com.jozufozu.flywheel.backend.instancing; + +import com.jozufozu.flywheel.api.instancer.InstancedPart; +import com.jozufozu.flywheel.api.struct.StructType; +import com.jozufozu.flywheel.core.model.Model; + +public record InstancerKey(StructType type, Model model) { +} diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingEngine.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingEngine.java index 994489382..b16eef6ab 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingEngine.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingEngine.java @@ -1,18 +1,16 @@ package com.jozufozu.flywheel.backend.instancing.batching; -import java.util.HashMap; import java.util.List; -import java.util.Map; - -import org.jetbrains.annotations.NotNull; import com.jozufozu.flywheel.api.RenderStage; import com.jozufozu.flywheel.api.instancer.InstancedPart; +import com.jozufozu.flywheel.api.instancer.Instancer; import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.backend.instancing.Engine; import com.jozufozu.flywheel.backend.instancing.InstanceManager; import com.jozufozu.flywheel.backend.instancing.TaskEngine; import com.jozufozu.flywheel.core.RenderContext; +import com.jozufozu.flywheel.core.model.Model; import com.jozufozu.flywheel.util.FlwUtil; import com.mojang.blaze3d.vertex.PoseStack; @@ -25,18 +23,10 @@ import net.minecraft.world.phys.Vec3; public class BatchingEngine implements Engine { protected final BatchingTransformManager transformManager = new BatchingTransformManager(); protected final BatchingDrawTracker drawTracker = new BatchingDrawTracker(); - protected final Map, CPUInstancerFactory> factories = new HashMap<>(); - @SuppressWarnings("unchecked") - @NotNull @Override - public CPUInstancerFactory factory(StructType type) { - return (CPUInstancerFactory) factories.computeIfAbsent(type, this::createFactory); - } - - @NotNull - private CPUInstancerFactory createFactory(StructType type) { - return new CPUInstancerFactory<>(type, transformManager::create); + public Instancer instancer(StructType type, Model model) { + return transformManager.getInstancer(type, model); } @Override @@ -105,7 +95,6 @@ public class BatchingEngine implements Engine { @Override public void delete() { - factories.clear(); transformManager.delete(); } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingTransformManager.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingTransformManager.java index 7452b7da3..d4949c223 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingTransformManager.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/BatchingTransformManager.java @@ -15,6 +15,10 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ListMultimap; import com.jozufozu.flywheel.api.RenderStage; +import com.jozufozu.flywheel.api.instancer.InstancedPart; +import com.jozufozu.flywheel.api.instancer.Instancer; +import com.jozufozu.flywheel.api.struct.StructType; +import com.jozufozu.flywheel.backend.instancing.InstancerKey; import com.jozufozu.flywheel.core.model.Mesh; import com.jozufozu.flywheel.core.model.Model; import com.mojang.blaze3d.vertex.VertexFormat; @@ -22,6 +26,7 @@ import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.client.renderer.RenderType; public class BatchingTransformManager { + private final Map, CPUInstancer> instancers = new HashMap<>(); private final List uninitializedModels = new ArrayList<>(); private final List> allInstancers = new ArrayList<>(); private final Map transformSets = new EnumMap<>(RenderStage.class); @@ -36,8 +41,16 @@ public class BatchingTransformManager { return transformSetsView; } - public void create(CPUInstancer instancer, Model model) { - uninitializedModels.add(new UninitializedModel(instancer, model)); + @SuppressWarnings("unchecked") + public Instancer getInstancer(StructType type, Model model) { + InstancerKey key = new InstancerKey<>(type, model); + CPUInstancer instancer = (CPUInstancer) instancers.get(key); + if (instancer == null) { + instancer = new CPUInstancer<>(type); + instancers.put(key, instancer); + uninitializedModels.add(new UninitializedModel(instancer, model)); + } + return instancer; } public void flush() { @@ -52,6 +65,8 @@ public class BatchingTransformManager { } public void delete() { + instancers.clear(); + meshPools.values() .forEach(BatchedMeshPool::delete); meshPools.clear(); diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/CPUInstancerFactory.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/CPUInstancerFactory.java deleted file mode 100644 index 65afe705c..000000000 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/batching/CPUInstancerFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.jozufozu.flywheel.backend.instancing.batching; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.BiConsumer; - -import com.jozufozu.flywheel.api.instancer.InstancedPart; -import com.jozufozu.flywheel.api.instancer.Instancer; -import com.jozufozu.flywheel.api.instancer.InstancerFactory; -import com.jozufozu.flywheel.api.struct.StructType; -import com.jozufozu.flywheel.core.model.Model; - -public class CPUInstancerFactory implements InstancerFactory { - - protected final StructType type; - private final BiConsumer, Model> creationListener; - protected final Map> models = new HashMap<>(); - - public CPUInstancerFactory(StructType type, BiConsumer, Model> creationListener) { - this.type = type; - this.creationListener = creationListener; - } - - @Override - public Instancer model(Model modelKey) { - return models.computeIfAbsent(modelKey, this::createInstancer); - } - - private CPUInstancer createInstancer(Model model) { - var instancer = new CPUInstancer<>(type); - creationListener.accept(instancer, model); - return instancer; - } -} diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/blockentity/BlockEntityInstance.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/blockentity/BlockEntityInstance.java index 7689ca9a2..7cda44ec0 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/blockentity/BlockEntityInstance.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/blockentity/BlockEntityInstance.java @@ -6,12 +6,8 @@ import java.util.List; import com.jozufozu.flywheel.api.instance.DynamicInstance; import com.jozufozu.flywheel.api.instance.TickableInstance; import com.jozufozu.flywheel.api.instancer.InstancedPart; -import com.jozufozu.flywheel.api.instancer.InstancerFactory; import com.jozufozu.flywheel.api.instancer.InstancerManager; import com.jozufozu.flywheel.backend.instancing.AbstractInstance; -import com.jozufozu.flywheel.core.structs.StructTypes; -import com.jozufozu.flywheel.core.structs.oriented.OrientedPart; -import com.jozufozu.flywheel.core.structs.transformed.TransformedPart; import com.jozufozu.flywheel.util.box.GridAlignedBB; import com.jozufozu.flywheel.util.box.ImmutableBox; import com.jozufozu.flywheel.util.joml.FrustumIntersection; diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectDrawManager.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectDrawManager.java index 18519271f..8b911d22b 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectDrawManager.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectDrawManager.java @@ -6,19 +6,30 @@ import java.util.List; import java.util.Map; import com.jozufozu.flywheel.api.instancer.InstancedPart; +import com.jozufozu.flywheel.api.instancer.Instancer; import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.api.vertex.VertexType; +import com.jozufozu.flywheel.backend.instancing.InstancerKey; import com.jozufozu.flywheel.core.model.Model; import com.jozufozu.flywheel.util.Pair; public class IndirectDrawManager { + private final Map, IndirectInstancer> instancers = new HashMap<>(); private final List uninitializedModels = new ArrayList<>(); private final List> allInstancers = new ArrayList<>(); public final Map, VertexType>, IndirectCullingGroup> renderLists = new HashMap<>(); - public void create(IndirectInstancer instancer, Model model) { - uninitializedModels.add(new UninitializedModel(instancer, model)); + @SuppressWarnings("unchecked") + public Instancer getInstancer(StructType type, Model model) { + InstancerKey key = new InstancerKey<>(type, model); + IndirectInstancer instancer = (IndirectInstancer) instancers.get(key); + if (instancer == null) { + instancer = new IndirectInstancer<>(type); + instancers.put(key, instancer); + uninitializedModels.add(new UninitializedModel(instancer, model)); + } + return instancer; } public void flush() { @@ -33,6 +44,8 @@ public class IndirectDrawManager { } public void delete() { + instancers.clear(); + renderLists.values() .forEach(IndirectCullingGroup::delete); renderLists.clear(); diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectEngine.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectEngine.java index 53bf9baba..e30da3dde 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectEngine.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectEngine.java @@ -1,16 +1,14 @@ package com.jozufozu.flywheel.backend.instancing.indirect; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import org.jetbrains.annotations.NotNull; import org.lwjgl.opengl.GL32; import com.jozufozu.flywheel.api.RenderStage; import com.jozufozu.flywheel.api.context.ContextShader; import com.jozufozu.flywheel.api.instancer.InstancedPart; +import com.jozufozu.flywheel.api.instancer.Instancer; import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.backend.gl.GlStateTracker; import com.jozufozu.flywheel.backend.gl.GlTextureUnit; @@ -18,6 +16,7 @@ import com.jozufozu.flywheel.backend.instancing.Engine; import com.jozufozu.flywheel.backend.instancing.InstanceManager; import com.jozufozu.flywheel.backend.instancing.TaskEngine; import com.jozufozu.flywheel.core.RenderContext; +import com.jozufozu.flywheel.core.model.Model; import com.jozufozu.flywheel.util.WeakHashSet; import com.mojang.blaze3d.systems.RenderSystem; @@ -31,7 +30,6 @@ import net.minecraft.world.phys.Vec3; public class IndirectEngine implements Engine { protected final IndirectDrawManager drawManager = new IndirectDrawManager(); - protected final Map, IndirectInstancerFactory> factories = new HashMap<>(); /** * The set of instance managers that are attached to this engine. @@ -48,16 +46,9 @@ public class IndirectEngine implements Engine { this.sqrMaxOriginDistance = sqrMaxOriginDistance; } - @SuppressWarnings("unchecked") - @NotNull @Override - public IndirectInstancerFactory factory(StructType type) { - return (IndirectInstancerFactory) factories.computeIfAbsent(type, this::createFactory); - } - - @NotNull - private IndirectInstancerFactory createFactory(StructType type) { - return new IndirectInstancerFactory<>(type, drawManager::create); + public Instancer instancer(StructType type, Model model) { + return drawManager.getInstancer(type, model); } @Override @@ -124,7 +115,6 @@ public class IndirectEngine implements Engine { @Override public void delete() { - factories.clear(); drawManager.delete(); } diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectInstancerFactory.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectInstancerFactory.java deleted file mode 100644 index 286d3bc10..000000000 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/indirect/IndirectInstancerFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.jozufozu.flywheel.backend.instancing.indirect; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.BiConsumer; - -import com.jozufozu.flywheel.api.instancer.InstancedPart; -import com.jozufozu.flywheel.api.instancer.Instancer; -import com.jozufozu.flywheel.api.instancer.InstancerFactory; -import com.jozufozu.flywheel.api.struct.StructType; -import com.jozufozu.flywheel.core.model.Model; - -public class IndirectInstancerFactory implements InstancerFactory { - - protected final StructType type; - private final BiConsumer, Model> creationListener; - protected final Map> models = new HashMap<>(); - - public IndirectInstancerFactory(StructType type, BiConsumer, Model> creationListener) { - this.type = type; - this.creationListener = creationListener; - } - - @Override - public Instancer model(Model modelKey) { - return models.computeIfAbsent(modelKey, this::createInstancer); - } - - private IndirectInstancer createInstancer(Model model) { - var instancer = new IndirectInstancer<>(type); - creationListener.accept(instancer, model); - return instancer; - } -} diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/GPUInstancerFactory.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/GPUInstancerFactory.java deleted file mode 100644 index 0f4a21f09..000000000 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/GPUInstancerFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.jozufozu.flywheel.backend.instancing.instancing; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.BiConsumer; - -import com.jozufozu.flywheel.api.instancer.InstancedPart; -import com.jozufozu.flywheel.api.instancer.Instancer; -import com.jozufozu.flywheel.api.instancer.InstancerFactory; -import com.jozufozu.flywheel.api.struct.StructType; -import com.jozufozu.flywheel.core.model.Model; - -/** - * A collection of Instancers that all have the same format. - * @param - */ -public class GPUInstancerFactory implements InstancerFactory { - - protected final StructType type; - private final BiConsumer, Model> creationListener; - protected final Map> models = new HashMap<>(); - - public GPUInstancerFactory(StructType type, BiConsumer, Model> creationListener) { - this.type = type; - this.creationListener = creationListener; - } - - @Override - public Instancer model(Model modelKey) { - return models.computeIfAbsent(modelKey, this::createInstancer); - } - - private GPUInstancer createInstancer(Model model) { - var instancer = new GPUInstancer<>(type); - creationListener.accept(instancer, model); - return instancer; - } -} diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingDrawManager.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingDrawManager.java index 27afd6743..14b943db1 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingDrawManager.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingDrawManager.java @@ -14,12 +14,17 @@ import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ListMultimap; import com.jozufozu.flywheel.api.RenderStage; +import com.jozufozu.flywheel.api.instancer.InstancedPart; +import com.jozufozu.flywheel.api.instancer.Instancer; +import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.api.vertex.VertexType; +import com.jozufozu.flywheel.backend.instancing.InstancerKey; import com.jozufozu.flywheel.core.model.Mesh; import com.jozufozu.flywheel.core.model.Model; public class InstancingDrawManager { + private final Map, GPUInstancer> instancers = new HashMap<>(); private final List uninitializedModels = new ArrayList<>(); private final List> allInstancers = new ArrayList<>(); private final Map renderLists = new EnumMap<>(RenderStage.class); @@ -29,8 +34,16 @@ public class InstancingDrawManager { return renderLists.getOrDefault(stage, DrawSet.EMPTY); } - public void create(GPUInstancer instancer, Model model) { - uninitializedModels.add(new UninitializedModel(instancer, model)); + @SuppressWarnings("unchecked") + public Instancer getInstancer(StructType type, Model model) { + InstancerKey key = new InstancerKey<>(type, model); + GPUInstancer instancer = (GPUInstancer) instancers.get(key); + if (instancer == null) { + instancer = new GPUInstancer<>(type); + instancers.put(key, instancer); + uninitializedModels.add(new UninitializedModel(instancer, model)); + } + return instancer; } public void flush() { @@ -48,6 +61,8 @@ public class InstancingDrawManager { } public void delete() { + instancers.clear(); + meshPools.values() .forEach(InstancedMeshPool::delete); meshPools.clear(); diff --git a/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingEngine.java b/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingEngine.java index 47096cb01..48af470e7 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingEngine.java +++ b/src/main/java/com/jozufozu/flywheel/backend/instancing/instancing/InstancingEngine.java @@ -1,16 +1,14 @@ package com.jozufozu.flywheel.backend.instancing.instancing; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import org.jetbrains.annotations.NotNull; import org.lwjgl.opengl.GL32; import com.jozufozu.flywheel.api.RenderStage; import com.jozufozu.flywheel.api.context.ContextShader; import com.jozufozu.flywheel.api.instancer.InstancedPart; +import com.jozufozu.flywheel.api.instancer.Instancer; import com.jozufozu.flywheel.api.struct.StructType; import com.jozufozu.flywheel.backend.gl.GlStateTracker; import com.jozufozu.flywheel.backend.gl.GlTextureUnit; @@ -20,6 +18,7 @@ import com.jozufozu.flywheel.backend.instancing.PipelineCompiler; import com.jozufozu.flywheel.backend.instancing.TaskEngine; import com.jozufozu.flywheel.core.Components; import com.jozufozu.flywheel.core.RenderContext; +import com.jozufozu.flywheel.core.model.Model; import com.jozufozu.flywheel.core.uniform.UniformBuffer; import com.jozufozu.flywheel.util.WeakHashSet; import com.mojang.blaze3d.systems.RenderSystem; @@ -34,7 +33,6 @@ import net.minecraft.world.phys.Vec3; public class InstancingEngine implements Engine { protected final InstancingDrawManager drawManager = new InstancingDrawManager(); - protected final Map, GPUInstancerFactory> factories = new HashMap<>(); /** * The set of instance managers that are attached to this engine. @@ -51,16 +49,9 @@ public class InstancingEngine implements Engine { this.sqrMaxOriginDistance = sqrMaxOriginDistance; } - @SuppressWarnings("unchecked") - @NotNull @Override - public GPUInstancerFactory factory(StructType type) { - return (GPUInstancerFactory) factories.computeIfAbsent(type, this::createFactory); - } - - @NotNull - private GPUInstancerFactory createFactory(StructType type) { - return new GPUInstancerFactory<>(type, drawManager::create); + public Instancer instancer(StructType type, Model model) { + return drawManager.getInstancer(type, model); } @Override @@ -167,7 +158,6 @@ public class InstancingEngine implements Engine { @Override public void delete() { - factories.clear(); drawManager.delete(); } diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java b/src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java index 1336d3ae7..5590feb19 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/BellInstance.java @@ -72,8 +72,7 @@ public class BellInstance extends BlockEntityInstance implement } private OrientedPart createBellInstance() { - return instancerManager.factory(StructTypes.ORIENTED) - .model(MODEL) + return instancerManager.instancer(StructTypes.ORIENTED, MODEL) .createInstance(); } diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java b/src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java index 0089766d2..cc638c759 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/ChestInstance.java @@ -123,15 +123,13 @@ public class ChestInstance extends Block private OrientedPart baseInstance() { - return instancerManager.factory(StructTypes.ORIENTED) - .model(BASE.apply(chestType, sprite)) + return instancerManager.instancer(StructTypes.ORIENTED, BASE.apply(chestType, sprite)) .createInstance(); } private TransformedPart lidInstance() { - return instancerManager.factory(StructTypes.TRANSFORMED) - .model(LID.apply(chestType, sprite)) + return instancerManager.instancer(StructTypes.TRANSFORMED, LID.apply(chestType, sprite)) .createInstance(); } diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/MinecartInstance.java b/src/main/java/com/jozufozu/flywheel/vanilla/MinecartInstance.java index d1ae67501..dff5d40c5 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/MinecartInstance.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/MinecartInstance.java @@ -167,14 +167,12 @@ public class MinecartInstance extends EntityInstance if (shape == RenderShape.INVISIBLE) return null; - return instancerManager.factory(StructTypes.TRANSFORMED) - .model(Models.block(blockState)) + return instancerManager.instancer(StructTypes.TRANSFORMED, Models.block(blockState)) .createInstance(); } private TransformedPart getBody() { - return instancerManager.factory(StructTypes.TRANSFORMED) - .model(MODEL) + return instancerManager.instancer(StructTypes.TRANSFORMED, MODEL) .createInstance(); } diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxInstance.java b/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxInstance.java index cfe63f41d..bedf46f9f 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxInstance.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxInstance.java @@ -105,14 +105,12 @@ public class ShulkerBoxInstance extends BlockEntityInstance