From f4598a97f7a9d4b2daf27d18deb19bf4741a4e2e Mon Sep 17 00:00:00 2001 From: LexManos Date: Mon, 24 Jun 2019 20:05:50 -0700 Subject: [PATCH] Fix vines and scaffolding not being climbable. Fix powered rails not spreading power correctly. Closes: #5854 --- .../minecraft/block/PoweredRailBlock.java.patch | 14 +++++++++++--- .../minecraft/block/ScaffoldingBlock.java.patch | 11 +++++++++++ .../net/minecraft/block/VineBlock.java.patch | 7 +++++++ .../java/net/minecraftforge/common/ForgeHooks.java | 4 ++-- 4 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 patches/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch diff --git a/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch b/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch index 871ec0df0..ded7d829c 100644 --- a/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/PoweredRailBlock.java.patch @@ -18,12 +18,20 @@ } protected boolean func_176566_a(World p_176566_1_, BlockPos p_176566_2_, BlockState p_176566_3_, boolean p_176566_4_, int p_176566_5_) { -@@ -105,7 +111,7 @@ - RailShape railshape = blockstate.func_177229_b(field_176568_b); +@@ -99,13 +105,13 @@ + + protected boolean func_208071_a(World p_208071_1_, BlockPos p_208071_2_, boolean p_208071_3_, int p_208071_4_, RailShape p_208071_5_) { + BlockState blockstate = p_208071_1_.func_180495_p(p_208071_2_); +- if (blockstate.func_177230_c() != this) { ++ if (!(blockstate.func_177230_c() instanceof PoweredRailBlock)) { + return false; + } else { +- RailShape railshape = blockstate.func_177229_b(field_176568_b); ++ RailShape railshape = getRailDirection(blockstate, p_208071_1_, p_208071_2_, null); if (p_208071_5_ != RailShape.EAST_WEST || railshape != RailShape.NORTH_SOUTH && railshape != RailShape.ASCENDING_NORTH && railshape != RailShape.ASCENDING_SOUTH) { if (p_208071_5_ != RailShape.NORTH_SOUTH || railshape != RailShape.EAST_WEST && railshape != RailShape.ASCENDING_EAST && railshape != RailShape.ASCENDING_WEST) { - if (blockstate.func_177229_b(field_176569_M)) { -+ if (!(blockstate.func_177230_c() instanceof PoweredRailBlock) || isActivator != ((PoweredRailBlock)blockstate.func_177230_c()).isActivator) { ++ if (isActivator == ((PoweredRailBlock)blockstate.func_177230_c()).isActivator) { return p_208071_1_.func_175640_z(p_208071_2_) ? true : this.func_176566_a(p_208071_1_, p_208071_2_, blockstate, p_208071_3_, p_208071_4_ + 1); } else { return false; diff --git a/patches/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch b/patches/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch new file mode 100644 index 000000000..66374e498 --- /dev/null +++ b/patches/minecraft/net/minecraft/block/ScaffoldingBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/block/ScaffoldingBlock.java ++++ b/net/minecraft/block/ScaffoldingBlock.java +@@ -142,6 +142,8 @@ + return i; + } + ++ @Override public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { return true; } ++ + static { + VoxelShape voxelshape = Block.func_208617_a(0.0D, 14.0D, 0.0D, 16.0D, 16.0D, 16.0D); + VoxelShape voxelshape1 = Block.func_208617_a(0.0D, 0.0D, 0.0D, 2.0D, 16.0D, 2.0D); diff --git a/patches/minecraft/net/minecraft/block/VineBlock.java.patch b/patches/minecraft/net/minecraft/block/VineBlock.java.patch index d94b5c9df..645813757 100644 --- a/patches/minecraft/net/minecraft/block/VineBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/VineBlock.java.patch @@ -18,3 +18,10 @@ Direction direction = Direction.func_176741_a(p_196267_4_); BlockPos blockpos = p_196267_3_.func_177984_a(); if (direction.func_176740_k().func_176722_c() && !p_196267_1_.func_177229_b(func_176267_a(direction))) { +@@ -329,4 +329,6 @@ + public static BooleanProperty func_176267_a(Direction p_176267_0_) { + return field_196546_A.get(p_176267_0_); + } ++ ++ @Override public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, net.minecraft.entity.LivingEntity entity) { return true; } + } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index 485666995..dcb172ad4 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -384,7 +384,7 @@ public class ForgeHooks if (isSpectator) return false; if (!ForgeConfig.SERVER.fullBoundingBoxLadders.get()) { - return state.getBlock().isLadder(state, world, pos, entity); + return state.isLadder(world, pos, entity); } else { @@ -400,7 +400,7 @@ public class ForgeHooks { BlockPos tmp = new BlockPos(x2, y2, z2); state = world.getBlockState(tmp); - if (state.getBlock().isLadder(state, world, tmp, entity)) + if (state.isLadder(world, tmp, entity)) { return true; }