Files
CatServer/patches/net/minecraft/block/BlockPistonMoving.java.patch
2019-02-24 22:29:41 +08:00

38 lines
1.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java
@@ -116,7 +116,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!worldIn.isRemote)
+ if (false && !worldIn.isRemote) // Forge: Noop this out
{
TileEntityPiston tileentitypiston = this.getTilePistonAt(worldIn, pos);
@@ -126,6 +126,7 @@
iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0);
}
}
+ super.dropBlockAsItemWithChance(worldIn, pos, state, 1, fortune); // mimic vanilla behavior from above and ignore chance
}
@Nullable
@@ -210,6 +211,17 @@
return new BlockStateContainer(this, new IProperty[] {FACING, TYPE});
}
+ @Override
+ public void getDrops(net.minecraft.util.NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ TileEntityPiston tileentitypiston = this.getTilePistonAt(world, pos);
+ if (tileentitypiston != null)
+ {
+ IBlockState pushed = tileentitypiston.getPistonState();
+ drops.addAll(pushed.getBlock().getDrops(world, pos, pushed, fortune)); // use the old method until it gets removed, for backward compatibility
+ }
+ }
+
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
{
return BlockFaceShape.UNDEFINED;