Skip to content

Commit

Permalink
Make fence gates detect modded walls
Browse files Browse the repository at this point in the history
  • Loading branch information
jss2a98aj committed Apr 18, 2024
1 parent 46f3262 commit 754c217
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockWall;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(value = RenderBlocks.class)
public abstract class MixinRenderBlocks {
Expand Down Expand Up @@ -65,6 +69,22 @@ public boolean renderBlockFence(BlockFence fence, int x, int y, int z) {
return true;
}

/**
* @author jss2a98aj
* @reason Fix modded wall detection
*/
@Redirect(
method = "renderBlockFenceGate(Lnet/minecraft/block/BlockFenceGate;III)Z",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/IBlockAccess;getBlock(III)Lnet/minecraft/block/Block;"
),
expect = 4
)
Block detectModdedWalls(IBlockAccess world, int x, int y, int z) {
return world.getBlock(x, y, z) instanceof BlockWall ? Blocks.cobblestone_wall : null;
}

@Shadow public IBlockAccess blockAccess;
@Shadow public boolean field_152631_f;
@Shadow public abstract void setRenderBounds(double minX, double minY, double minZ, double maxX, double maxY, double maxZ);
Expand Down

0 comments on commit 754c217

Please sign in to comment.