Files
MinecraftForge/patches/minecraft/net/minecraft/block/PistonBlock.java.patch
T
embeddedt ed3ac8a122 [1.16.5] Update more parts of the toolchain (#9825)
* ForgeGradle 6, Gradle 8.4, ASM 9.6
* Apply official mappings to patches (still using MCP classnames)
* Remove reference to SpecialSource in reobfJar-like tasks
* Backport modern MDK
* Rename TransformationMatrix methods to prevent reobf, add back vanilla name via coremod
2023-12-20 10:49:06 -08:00

56 lines
2.8 KiB
Diff

--- a/net/minecraft/block/PistonBlock.java
+++ b/net/minecraft/block/PistonBlock.java
@@ -158,6 +_,7 @@
}
if (p_189539_4_ == 0) {
+ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, true)) return false;
if (!this.moveBlocks(p_189539_2_, p_189539_3_, direction, true)) {
return false;
}
@@ -165,6 +_,7 @@
p_189539_2_.setBlock(p_189539_3_, p_189539_1_.setValue(EXTENDED, Boolean.valueOf(true)), 67);
p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, SoundEvents.PISTON_EXTEND, SoundCategory.BLOCKS, 0.5F, p_189539_2_.random.nextFloat() * 0.25F + 0.6F);
} else if (p_189539_4_ == 1 || p_189539_4_ == 2) {
+ if (net.minecraftforge.event.ForgeEventFactory.onPistonMovePre(p_189539_2_, p_189539_3_, direction, false)) return false;
TileEntity tileentity1 = p_189539_2_.getBlockEntity(p_189539_3_.relative(direction));
if (tileentity1 instanceof PistonTileEntity) {
((PistonTileEntity)tileentity1).finalTick();
@@ -204,6 +_,7 @@
p_189539_2_.playSound((PlayerEntity)null, p_189539_3_, SoundEvents.PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, p_189539_2_.random.nextFloat() * 0.15F + 0.6F);
}
+ net.minecraftforge.event.ForgeEventFactory.onPistonMovePost(p_189539_2_, p_189539_3_, direction, (p_189539_4_ == 0));
return true;
}
@@ -234,7 +_,7 @@
return false;
}
- return !p_185646_0_.getBlock().isEntityBlock();
+ return !p_185646_0_.hasTileEntity();
}
} else {
return false;
@@ -273,7 +_,7 @@
for(int k = list2.size() - 1; k >= 0; --k) {
BlockPos blockpos2 = list2.get(k);
BlockState blockstate1 = p_176319_1_.getBlockState(blockpos2);
- TileEntity tileentity = blockstate1.getBlock().isEntityBlock() ? p_176319_1_.getBlockEntity(blockpos2) : null;
+ TileEntity tileentity = blockstate1.hasTileEntity() ? p_176319_1_.getBlockEntity(blockpos2) : null;
dropResources(blockstate1, p_176319_1_, blockpos2, tileentity);
p_176319_1_.setBlock(blockpos2, Blocks.AIR.defaultBlockState(), 18);
ablockstate[j++] = blockstate1;
@@ -335,6 +_,10 @@
public BlockState rotate(BlockState p_185499_1_, Rotation p_185499_2_) {
return p_185499_1_.setValue(FACING, p_185499_2_.rotate(p_185499_1_.getValue(FACING)));
+ }
+
+ public BlockState rotate(BlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) {
+ return state.getValue(EXTENDED) ? state : super.rotate(state, world, pos, direction);
}
public BlockState mirror(BlockState p_185471_1_, Mirror p_185471_2_) {