Skip to content

Commit

Permalink
getsers
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyMialee committed May 28, 2022
1 parent 99f932d commit 19abc20
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 13 deletions.
16 changes: 12 additions & 4 deletions src/main/java/amymialee/visiblebarriers/VisibleBarriers.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public abstract class AirBlockMixin extends Block {
@Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true)
public void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
if (VisibleBarriers.visible_air) {
if (VisibleBarriers.isVisibleAir()) {
cir.setReturnValue(BlockRenderType.MODEL);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class BarrierBlockMixin {
@Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true)
public void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
if (VisibleBarriers.visible) {
if (VisibleBarriers.isVisible()) {
cir.setReturnValue(BlockRenderType.MODEL);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Boolean> cir) {
if (VisibleBarriers.visible) {
if (VisibleBarriers.isVisible()) {
cir.setReturnValue(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class LightBlockMixin {
@Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true)
public void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
if (VisibleBarriers.visible) {
if (VisibleBarriers.isVisible()) {
cir.setReturnValue(BlockRenderType.MODEL);
}
}
Expand All @@ -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<VoxelShape> cir) {
if (VisibleBarriers.visible) {
if (VisibleBarriers.isVisible()) {
cir.setReturnValue(VoxelShapes.fullCube());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class StructureVoidBlockMixin {
@Inject(method = "getRenderType", at = @At("HEAD"), cancellable = true)
public void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
if (VisibleBarriers.visible) {
if (VisibleBarriers.isVisible()) {
cir.setReturnValue(BlockRenderType.MODEL);
}
}
Expand Down

0 comments on commit 19abc20

Please sign in to comment.