diff --git a/build.gradle b/build.gradle index a41dd74..f2dda7b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.7-SNAPSHOT' id 'maven-publish' } @@ -35,13 +35,13 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } java { withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { diff --git a/gradle.properties b/gradle.properties index 7ae76e1..f9fe4d3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties on https://modmuss50.me/fabric.html minecraft_version=1.21 -yarn_mappings=1.21+build.2 +yarn_mappings=1.21+build.9 loader_version=0.15.11 # Mod Properties -mod_version=2.0.14 +mod_version=2.0.15 maven_group=amymialee archives_base_name=visiblebarriers # Dependencies -fabric_version=0.100.1+1.21 \ No newline at end of file +fabric_version=0.100.7+1.21 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..09523c0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/xyz/amymialee/visiblebarriers/VisibleBarriers.java b/src/main/java/xyz/amymialee/visiblebarriers/VisibleBarriers.java index 4ae616c..b10f511 100644 --- a/src/main/java/xyz/amymialee/visiblebarriers/VisibleBarriers.java +++ b/src/main/java/xyz/amymialee/visiblebarriers/VisibleBarriers.java @@ -61,7 +61,7 @@ public static void booleanFeedback(String key, boolean value) { } public static void reloadWorldRenderer() { - MinecraftClient.getInstance().worldRenderer.reload(); + if (MinecraftClient.getInstance().worldRenderer != null) MinecraftClient.getInstance().worldRenderer.reload(); } public static boolean isVisibilityEnabled() { diff --git a/src/main/java/xyz/amymialee/visiblebarriers/mixin/client/ClientBarrierBlockMixin.java b/src/main/java/xyz/amymialee/visiblebarriers/mixin/client/ClientBarrierBlockMixin.java new file mode 100644 index 0000000..0d9b896 --- /dev/null +++ b/src/main/java/xyz/amymialee/visiblebarriers/mixin/client/ClientBarrierBlockMixin.java @@ -0,0 +1,21 @@ +package xyz.amymialee.visiblebarriers.mixin.client; + +import net.minecraft.block.BarrierBlock; +import net.minecraft.block.BlockState; +import net.minecraft.util.math.Direction; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import xyz.amymialee.visiblebarriers.VisibleBarriers; +import xyz.amymialee.visiblebarriers.mixin.boxing.BlockMixin; + +@Mixin(BarrierBlock.class) +public abstract class ClientBarrierBlockMixin extends BlockMixin { + + @Override + public void visibleBarriers$isSideInvisible(BlockState state, BlockState stateFrom, Direction direction, CallbackInfoReturnable cir) { + if (VisibleBarriers.isVisibilityEnabled() || VisibleBarriers.areBarriersEnabled()) { + cir.setReturnValue(stateFrom.isOpaque() || stateFrom.getBlock() == state.getBlock()); + } + } + +} \ No newline at end of file diff --git a/src/main/java/xyz/amymialee/visiblebarriers/mixin/client/LightBlockMixin.java b/src/main/java/xyz/amymialee/visiblebarriers/mixin/client/LightBlockMixin.java index ef3caf4..d51e6e4 100644 --- a/src/main/java/xyz/amymialee/visiblebarriers/mixin/client/LightBlockMixin.java +++ b/src/main/java/xyz/amymialee/visiblebarriers/mixin/client/LightBlockMixin.java @@ -8,6 +8,7 @@ import net.minecraft.block.ShapeContext; import net.minecraft.item.Item; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; @@ -37,4 +38,12 @@ public abstract class LightBlockMixin extends BlockMixin { } super.visibleBarriers$getCollisionShape(state, world, pos, context, cir); } + + @Override + public void visibleBarriers$isSideInvisible(BlockState state, BlockState stateFrom, Direction direction, CallbackInfoReturnable cir) { + if (VisibleBarriers.isVisibilityEnabled() || VisibleBarriers.areLightsEnabled()) { + cir.setReturnValue(stateFrom.isOpaque() || stateFrom.getBlock() == state.getBlock()); + } + } + } \ No newline at end of file diff --git a/src/main/resources/visiblebarriers.mixins.json b/src/main/resources/visiblebarriers.mixins.json index b262047..dcd0e90 100644 --- a/src/main/resources/visiblebarriers.mixins.json +++ b/src/main/resources/visiblebarriers.mixins.json @@ -16,6 +16,7 @@ "client": [ "boxing.EntityRendererMixin", "client.AbstractBlockStateMixin", + "client.ClientBarrierBlockMixin", "client.ClientBubbleColumnBlockMixin", "client.ClientPistonExtensionBlockMixin", "client.ClientPlayerInteractionManagerMixin",