mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-05-27 10:13:37 +02:00
add an option to disable rendering of items in pipes
This commit is contained in:
parent
c1ccdd8486
commit
687692b79a
32
src/main/java/de/ellpeck/prettypipes/Config.java
Normal file
32
src/main/java/de/ellpeck/prettypipes/Config.java
Normal file
|
@ -0,0 +1,32 @@
|
|||
package de.ellpeck.prettypipes;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class Config {
|
||||
public static class Client
|
||||
{
|
||||
public final ForgeConfigSpec.BooleanValue pipeRender;
|
||||
|
||||
public Client(ForgeConfigSpec.Builder builder)
|
||||
{
|
||||
builder.comment("Should items be rendered inside pipes?");
|
||||
pipeRender = builder.define("Pipe Rendering", true);
|
||||
}
|
||||
}
|
||||
|
||||
public static final ForgeConfigSpec CLIENT_SPEC;
|
||||
public static final Client CLIENT;
|
||||
static {
|
||||
{
|
||||
final Pair<Client, ForgeConfigSpec> specPair = new ForgeConfigSpec.Builder().configure(Client::new);
|
||||
CLIENT = specPair.getLeft();
|
||||
CLIENT_SPEC = specPair.getRight();
|
||||
}
|
||||
}
|
||||
public static void register() {
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, CLIENT_SPEC);
|
||||
}
|
||||
}
|
|
@ -11,6 +11,8 @@ public final class PrettyPipes {
|
|||
public static final String ID = "prettypipes";
|
||||
|
||||
public PrettyPipes() {
|
||||
Config.register();
|
||||
|
||||
var bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
bus.addListener(Registry::setup);
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> bus.addListener(Registry.Client::setup));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.ellpeck.prettypipes.pipe;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import de.ellpeck.prettypipes.Config;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
|
@ -21,7 +22,7 @@ public class PipeRenderer implements BlockEntityRenderer<PipeBlockEntity> {
|
|||
|
||||
@Override
|
||||
public void render(PipeBlockEntity tile, float partialTicks, PoseStack matrixStack, MultiBufferSource source, int light, int overlay) {
|
||||
if (!tile.getItems().isEmpty()) {
|
||||
if (!tile.getItems().isEmpty() && Config.CLIENT.pipeRender.get()) {
|
||||
matrixStack.pushPose();
|
||||
var tilePos = tile.getBlockPos();
|
||||
matrixStack.translate(-tilePos.getX(), -tilePos.getY(), -tilePos.getZ());
|
||||
|
|
Loading…
Reference in a new issue