Skip to content

Commit

Permalink
Merge pull request #64 from BuggyAl/main
Browse files Browse the repository at this point in the history
Cull barrier and light blocks
  • Loading branch information
AmyMialee authored Jul 18, 2024
2 parents 9cbd1c0 + fb17991 commit 6320ffe
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 9 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
fabric_version=0.100.7+1.21
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Boolean> cir) {
if (VisibleBarriers.isVisibilityEnabled() || VisibleBarriers.areBarriersEnabled()) {
cir.setReturnValue(stateFrom.isOpaque() || stateFrom.getBlock() == state.getBlock());
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Boolean> cir) {
if (VisibleBarriers.isVisibilityEnabled() || VisibleBarriers.areLightsEnabled()) {
cir.setReturnValue(stateFrom.isOpaque() || stateFrom.getBlock() == state.getBlock());
}
}

}
1 change: 1 addition & 0 deletions src/main/resources/visiblebarriers.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"client": [
"boxing.EntityRendererMixin",
"client.AbstractBlockStateMixin",
"client.ClientBarrierBlockMixin",
"client.ClientBubbleColumnBlockMixin",
"client.ClientPistonExtensionBlockMixin",
"client.ClientPlayerInteractionManagerMixin",
Expand Down

0 comments on commit 6320ffe

Please sign in to comment.