From 19abc2052e3f7cfc14150aef4b88ebbd7de5f38b Mon Sep 17 00:00:00 2001 From: AmyMialee <10999535+AmyMialee@users.noreply.github.com> Date: Sun, 29 May 2022 00:58:05 +0100 Subject: [PATCH] getsers --- .../visiblebarriers/VisibleBarriers.java | 16 ++++++++++++---- .../mixin/ArmorStandEntityRendererMixin.java | 2 +- .../mixin/EmptyEntityRendererMixin.java | 2 +- .../mixin/EntityRendererMixin.java | 2 +- .../mixin/visibility/AirBlockMixin.java | 2 +- .../mixin/visibility/BarrierBlockMixin.java | 2 +- .../mixin/visibility/ItemStackMixin.java | 2 +- .../mixin/visibility/LightBlockMixin.java | 4 ++-- .../visibility/StructureVoidBlockMixin.java | 2 +- 9 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/main/java/amymialee/visiblebarriers/VisibleBarriers.java b/src/main/java/amymialee/visiblebarriers/VisibleBarriers.java index 031c3e3..53f6895 100644 --- a/src/main/java/amymialee/visiblebarriers/VisibleBarriers.java +++ b/src/main/java/amymialee/visiblebarriers/VisibleBarriers.java @@ -26,8 +26,8 @@ public class VisibleBarriers implements ClientModInitializer { public static VisibleBarriersConfig config = null; private static KeyBinding keyBinding; - public static boolean visible = false; - public static boolean visible_air = false; + private static boolean visible = false; + private static boolean visibleAir = false; public static final ItemGroup EXTRA_ITEMS = FabricItemGroupBuilder.create(new Identifier(MODID, "extra_items")).icon(() -> new ItemStack(Items.COMMAND_BLOCK)) .appendItems(stacks -> { @@ -73,14 +73,22 @@ public void onInitializeClient() { visible = !visible; if (Screen.hasShiftDown()) { if (visible) { - visible_air = true; + visibleAir = true; } } if (!visible) { - visible_air = false; + visibleAir = false; } client.worldRenderer.reload(); } }); } + + public static boolean isVisible() { + return visible; + } + + public static boolean isVisibleAir() { + return visibleAir; + } } diff --git a/src/main/java/amymialee/visiblebarriers/mixin/ArmorStandEntityRendererMixin.java b/src/main/java/amymialee/visiblebarriers/mixin/ArmorStandEntityRendererMixin.java index 8196a20..dae0128 100644 --- a/src/main/java/amymialee/visiblebarriers/mixin/ArmorStandEntityRendererMixin.java +++ b/src/main/java/amymialee/visiblebarriers/mixin/ArmorStandEntityRendererMixin.java @@ -44,7 +44,7 @@ public void ArmorStandEntityRenderer(EntityRendererFactory.Context context, Call @Unique public void render(ArmorStandEntity itemEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { - if (itemEntity.isInvisible() && VisibleBarriers.visible) { + if (itemEntity.isInvisible() && VisibleBarriers.isVisible()) { renderInvis(itemEntity, f, g, matrixStack, vertexConsumerProvider, i); } super.render(itemEntity, f, g, matrixStack, vertexConsumerProvider, i); diff --git a/src/main/java/amymialee/visiblebarriers/mixin/EmptyEntityRendererMixin.java b/src/main/java/amymialee/visiblebarriers/mixin/EmptyEntityRendererMixin.java index 4ee544b..24d9c66 100644 --- a/src/main/java/amymialee/visiblebarriers/mixin/EmptyEntityRendererMixin.java +++ b/src/main/java/amymialee/visiblebarriers/mixin/EmptyEntityRendererMixin.java @@ -46,7 +46,7 @@ public void EmptyEntityRenderer(EntityRendererFactory.Context context, CallbackI @Unique public void render(T itemEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { - if (VisibleBarriers.visible) { + if (VisibleBarriers.isVisible()) { matrixStack.push(); if (this.itemStack == null) { if (itemEntity instanceof AreaEffectCloudEntity) { diff --git a/src/main/java/amymialee/visiblebarriers/mixin/EntityRendererMixin.java b/src/main/java/amymialee/visiblebarriers/mixin/EntityRendererMixin.java index 3ad364f..5ce01e5 100644 --- a/src/main/java/amymialee/visiblebarriers/mixin/EntityRendererMixin.java +++ b/src/main/java/amymialee/visiblebarriers/mixin/EntityRendererMixin.java @@ -40,7 +40,7 @@ public void EntityRenderer(EntityRendererFactory.Context context, CallbackInfo c @Inject(method = "render", at = @At("HEAD")) public void render(T itemEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) { - if (VisibleBarriers.visible && itemEntity instanceof LivingEntity living && living.hasStatusEffect(StatusEffects.INVISIBILITY)) { + if (VisibleBarriers.isVisible() && itemEntity instanceof LivingEntity living && living.hasStatusEffect(StatusEffects.INVISIBILITY)) { if (this.itemStack == null) { if (itemEntity.getPickBlockStack() != null) this.itemStack = itemEntity.getPickBlockStack().copy(); if (this.itemStack == null) this.itemStack = Items.STRUCTURE_VOID.getDefaultStack().copy(); diff --git a/src/main/java/amymialee/visiblebarriers/mixin/visibility/AirBlockMixin.java b/src/main/java/amymialee/visiblebarriers/mixin/visibility/AirBlockMixin.java index 6f19992..fdde789 100644 --- a/src/main/java/amymialee/visiblebarriers/mixin/visibility/AirBlockMixin.java +++ b/src/main/java/amymialee/visiblebarriers/mixin/visibility/AirBlockMixin.java @@ -18,7 +18,7 @@ public abstract class AirBlockMixin extends Block { @Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true) public void getRenderType(BlockState state, CallbackInfoReturnable cir) { - if (VisibleBarriers.visible_air) { + if (VisibleBarriers.isVisibleAir()) { cir.setReturnValue(BlockRenderType.MODEL); } } diff --git a/src/main/java/amymialee/visiblebarriers/mixin/visibility/BarrierBlockMixin.java b/src/main/java/amymialee/visiblebarriers/mixin/visibility/BarrierBlockMixin.java index b7ffb7d..4e2e3da 100644 --- a/src/main/java/amymialee/visiblebarriers/mixin/visibility/BarrierBlockMixin.java +++ b/src/main/java/amymialee/visiblebarriers/mixin/visibility/BarrierBlockMixin.java @@ -13,7 +13,7 @@ public class BarrierBlockMixin { @Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true) public void getRenderType(BlockState state, CallbackInfoReturnable cir) { - if (VisibleBarriers.visible) { + if (VisibleBarriers.isVisible()) { cir.setReturnValue(BlockRenderType.MODEL); } } diff --git a/src/main/java/amymialee/visiblebarriers/mixin/visibility/ItemStackMixin.java b/src/main/java/amymialee/visiblebarriers/mixin/visibility/ItemStackMixin.java index fa43a97..c03e682 100644 --- a/src/main/java/amymialee/visiblebarriers/mixin/visibility/ItemStackMixin.java +++ b/src/main/java/amymialee/visiblebarriers/mixin/visibility/ItemStackMixin.java @@ -11,7 +11,7 @@ public abstract class ItemStackMixin { @Inject(method = "isSectionVisible", at = @At(value = "HEAD"), cancellable = true) private static void isSectionVisible(int flags, ItemStack.TooltipSection tooltipSection, CallbackInfoReturnable cir) { - if (VisibleBarriers.visible) { + if (VisibleBarriers.isVisible()) { cir.setReturnValue(true); } } diff --git a/src/main/java/amymialee/visiblebarriers/mixin/visibility/LightBlockMixin.java b/src/main/java/amymialee/visiblebarriers/mixin/visibility/LightBlockMixin.java index d161563..4e7e353 100644 --- a/src/main/java/amymialee/visiblebarriers/mixin/visibility/LightBlockMixin.java +++ b/src/main/java/amymialee/visiblebarriers/mixin/visibility/LightBlockMixin.java @@ -19,7 +19,7 @@ public class LightBlockMixin { @Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true) public void getRenderType(BlockState state, CallbackInfoReturnable cir) { - if (VisibleBarriers.visible) { + if (VisibleBarriers.isVisible()) { cir.setReturnValue(BlockRenderType.MODEL); } } @@ -31,7 +31,7 @@ private static AbstractBlock.Settings injected(AbstractBlock.Settings settings) @Inject(method = "getOutlineShape", at = @At("HEAD"), cancellable = true) public void getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context, CallbackInfoReturnable cir) { - if (VisibleBarriers.visible) { + if (VisibleBarriers.isVisible()) { cir.setReturnValue(VoxelShapes.fullCube()); } } diff --git a/src/main/java/amymialee/visiblebarriers/mixin/visibility/StructureVoidBlockMixin.java b/src/main/java/amymialee/visiblebarriers/mixin/visibility/StructureVoidBlockMixin.java index 2fa74df..e82ae2e 100644 --- a/src/main/java/amymialee/visiblebarriers/mixin/visibility/StructureVoidBlockMixin.java +++ b/src/main/java/amymialee/visiblebarriers/mixin/visibility/StructureVoidBlockMixin.java @@ -13,7 +13,7 @@ public class StructureVoidBlockMixin { @Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true) public void getRenderType(BlockState state, CallbackInfoReturnable cir) { - if (VisibleBarriers.visible) { + if (VisibleBarriers.isVisible()) { cir.setReturnValue(BlockRenderType.MODEL); } }