diff --git a/.gitignore b/.gitignore index 9c476b1..99315dd 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ build # other eclipse run +run-server run-data .cache diff --git a/src/main/java/com/hlysine/create_power_loader/content/ChunkLoaderMovementBehaviour.java b/src/main/java/com/hlysine/create_power_loader/content/ChunkLoaderMovementBehaviour.java index 411a63e..7472827 100644 --- a/src/main/java/com/hlysine/create_power_loader/content/ChunkLoaderMovementBehaviour.java +++ b/src/main/java/com/hlysine/create_power_loader/content/ChunkLoaderMovementBehaviour.java @@ -1,8 +1,6 @@ package com.hlysine.create_power_loader.content; import com.hlysine.create_power_loader.config.CPLConfigs; -import com.hlysine.create_power_loader.content.andesitechunkloader.AndesiteChunkLoaderRenderer; -import com.hlysine.create_power_loader.content.brasschunkloader.BrassChunkLoaderRenderer; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.mojang.logging.LogUtils; import com.simibubi.create.content.contraptions.behaviour.MovementBehaviour; @@ -23,8 +21,6 @@ public class ChunkLoaderMovementBehaviour implements MovementBehaviour { private static final Logger LOGGER = LogUtils.getLogger(); - private static final AndesiteChunkLoaderRenderer ANDESITE_RENDERER = new AndesiteChunkLoaderRenderer(null); - private static final BrassChunkLoaderRenderer BRASS_RENDERER = new BrassChunkLoaderRenderer(null); public final LoaderType type; @@ -141,13 +137,7 @@ public void stopMoving(MovementContext context) { @Override public void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld, ContraptionMatrices matrices, MultiBufferSource buffer) { - if (type == LoaderType.ANDESITE) { - ANDESITE_RENDERER.renderInContraption(context, renderWorld, matrices, buffer); - } else if (type == LoaderType.BRASS) { - BRASS_RENDERER.renderInContraption(context, renderWorld, matrices, buffer); - } else { - throw new RuntimeException("Unknown block."); - } + ContraptionRenderer.renderInContraption(context, renderWorld, matrices, buffer, type); } private boolean shouldFunction(MovementContext context) { diff --git a/src/main/java/com/hlysine/create_power_loader/content/ContraptionRenderer.java b/src/main/java/com/hlysine/create_power_loader/content/ContraptionRenderer.java new file mode 100644 index 0000000..a70a462 --- /dev/null +++ b/src/main/java/com/hlysine/create_power_loader/content/ContraptionRenderer.java @@ -0,0 +1,24 @@ +package com.hlysine.create_power_loader.content; + +import com.hlysine.create_power_loader.content.andesitechunkloader.AndesiteChunkLoaderRenderer; +import com.hlysine.create_power_loader.content.brasschunkloader.BrassChunkLoaderRenderer; +import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; +import com.simibubi.create.content.contraptions.behaviour.MovementContext; +import com.simibubi.create.content.contraptions.render.ContraptionMatrices; +import net.minecraft.client.renderer.MultiBufferSource; + +public class ContraptionRenderer { + + private static final AndesiteChunkLoaderRenderer ANDESITE_RENDERER = new AndesiteChunkLoaderRenderer(null); + private static final BrassChunkLoaderRenderer BRASS_RENDERER = new BrassChunkLoaderRenderer(null); + + public static void renderInContraption(MovementContext context, VirtualRenderWorld renderWorld, ContraptionMatrices matrices, MultiBufferSource buffer, LoaderType type) { + if (type == LoaderType.ANDESITE) { + ANDESITE_RENDERER.renderInContraption(context, renderWorld, matrices, buffer); + } else if (type == LoaderType.BRASS) { + BRASS_RENDERER.renderInContraption(context, renderWorld, matrices, buffer); + } else { + throw new RuntimeException("Unknown block."); + } + } +}