From fd78c095b0f0a68aed3f9d5b12aa2240c5b9897e Mon Sep 17 00:00:00 2001 From: hugeblank Date: Mon, 31 May 2021 08:16:28 -0700 Subject: [PATCH 1/2] Make held tent bag fancy rendering a config option --- .../campanion/config/CampanionConfig.java | 2 ++ .../mixin/client/MixinItemRenderer.java | 21 ++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/terraformersmc/campanion/config/CampanionConfig.java b/src/main/java/com/terraformersmc/campanion/config/CampanionConfig.java index 0c42b39e..d54080ff 100644 --- a/src/main/java/com/terraformersmc/campanion/config/CampanionConfig.java +++ b/src/main/java/com/terraformersmc/campanion/config/CampanionConfig.java @@ -2,6 +2,8 @@ public class CampanionConfig { + public boolean renderTentContents = true; + public CampanionConfig() {} } diff --git a/src/main/java/com/terraformersmc/campanion/mixin/client/MixinItemRenderer.java b/src/main/java/com/terraformersmc/campanion/mixin/client/MixinItemRenderer.java index 1799f9c9..d42498e7 100644 --- a/src/main/java/com/terraformersmc/campanion/mixin/client/MixinItemRenderer.java +++ b/src/main/java/com/terraformersmc/campanion/mixin/client/MixinItemRenderer.java @@ -2,6 +2,7 @@ import com.terraformersmc.campanion.client.renderer.item.BuiltTentItemRenderer; import com.terraformersmc.campanion.client.renderer.item.SpearItemRenderer; +import com.terraformersmc.campanion.config.CampanionConfigManager; import com.terraformersmc.campanion.item.CampanionItems; import com.terraformersmc.campanion.item.SpearItem; import net.minecraft.block.Blocks; @@ -29,16 +30,16 @@ public void renderItem(LivingEntity entity, ItemStack stack, ModelTransformation if(stack.getItem() instanceof SpearItem && SpearItemRenderer.INSTANCE.render(entity, stack, renderMode, leftHanded, matrices, vertexConsumers, light, overlay, model)) { info.cancel(); } - if(stack.getItem() == CampanionItems.TENT_BAG && renderMode != ModelTransformation.Mode.GUI) { - matrices.push(); - matrices.scale(1/4F, 1/4F, 1/4F); - MinecraftClient.getInstance().getBlockRenderManager().getModel(Blocks.STONE.getDefaultState()).getTransformation().getTransformation(renderMode).apply(leftHanded, matrices); - boolean ret = BuiltTentItemRenderer.INSTANCE.render(stack, matrices, BlockPos.ORIGIN.up(500), vertexConsumers, light); - matrices.pop(); - if(ret) { - info.cancel(); - } - } + if(CampanionConfigManager.getConfig().renderTentContents && stack.getItem() == CampanionItems.TENT_BAG && renderMode != ModelTransformation.Mode.GUI) { + matrices.push(); + matrices.scale(1/4F, 1/4F, 1/4F); + MinecraftClient.getInstance().getBlockRenderManager().getModel(Blocks.STONE.getDefaultState()).getTransformation().getTransformation(renderMode).apply(leftHanded, matrices); + boolean ret = BuiltTentItemRenderer.INSTANCE.render(stack, matrices, BlockPos.ORIGIN.up(500), vertexConsumers, light); + matrices.pop(); + if(ret) { + info.cancel(); + } + } } } From cc9a2d166e238a9c2efc36736a4b66d3aacbe5a9 Mon Sep 17 00:00:00 2001 From: hugeblank Date: Tue, 1 Jun 2021 00:06:27 -0700 Subject: [PATCH 2/2] Add renderTentPlacement option Will not render the tent - keeps the existing invalid overlay --- .../terraformersmc/campanion/config/CampanionConfig.java | 1 + .../campanion/mixin/client/MixinWorldRenderer.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/terraformersmc/campanion/config/CampanionConfig.java b/src/main/java/com/terraformersmc/campanion/config/CampanionConfig.java index d54080ff..0c01b692 100644 --- a/src/main/java/com/terraformersmc/campanion/config/CampanionConfig.java +++ b/src/main/java/com/terraformersmc/campanion/config/CampanionConfig.java @@ -3,6 +3,7 @@ public class CampanionConfig { public boolean renderTentContents = true; + public boolean renderTentPlacement = true; public CampanionConfig() {} diff --git a/src/main/java/com/terraformersmc/campanion/mixin/client/MixinWorldRenderer.java b/src/main/java/com/terraformersmc/campanion/mixin/client/MixinWorldRenderer.java index 48e050eb..86b8140f 100644 --- a/src/main/java/com/terraformersmc/campanion/mixin/client/MixinWorldRenderer.java +++ b/src/main/java/com/terraformersmc/campanion/mixin/client/MixinWorldRenderer.java @@ -2,8 +2,8 @@ import com.terraformersmc.campanion.client.renderer.item.BuiltTentItemRenderer; import com.terraformersmc.campanion.client.util.TentPreviewImmediate; +import com.terraformersmc.campanion.config.CampanionConfigManager; import com.terraformersmc.campanion.item.PlaceableTentItem; -import com.terraformersmc.campanion.item.TentBagItem; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.Material; @@ -58,7 +58,9 @@ public void render(MatrixStack matrices, float tickDelta, long limitTime, boolea List list = tent.getErrorPosition(this.client.world, placePos, stack); TentPreviewImmediate.STORAGE.setApplyModifiers(!list.isEmpty()); - BuiltTentItemRenderer.INSTANCE.render(stack, matrices, placePos, immediate, -1); + if (CampanionConfigManager.getConfig().renderTentPlacement) { + BuiltTentItemRenderer.INSTANCE.render(stack, matrices, placePos, immediate, -1); + } for (BlockPos pos : list) { matrices.push();