Skip to content

Commit

Permalink
Fix chunk loader renderers being loaded on dedicated server
Browse files Browse the repository at this point in the history
  • Loading branch information
hlysine committed Jan 5, 2024
1 parent d979f20 commit 7395f4a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ build
# other
eclipse
run
run-server
run-data
.cache

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.");
}
}
}

0 comments on commit 7395f4a

Please sign in to comment.