Files
2019-02-24 22:29:41 +08:00

59 lines
2.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java
@@ -85,7 +85,7 @@
if (block != Blocks.ICE && block != Blocks.PACKED_ICE && block != Blocks.BARRIER)
{
BlockFaceShape blockfaceshape = iblockstate.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP);
- return blockfaceshape == BlockFaceShape.SOLID || iblockstate.getMaterial() == Material.LEAVES || block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 8;
+ return blockfaceshape == BlockFaceShape.SOLID || iblockstate.getBlock().isLeaves(iblockstate, worldIn, pos.down()) || block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() == 8;
}
else
{
@@ -102,7 +102,6 @@
{
if (!this.canPlaceBlockAt(worldIn, pos))
{
- this.dropBlockAsItem(worldIn, pos, state, 0);
worldIn.setBlockToAir(pos);
return false;
}
@@ -114,9 +113,8 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack)
{
- spawnAsEntity(worldIn, pos, new ItemStack(Items.SNOWBALL, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0));
+ super.harvestBlock(worldIn, player, pos, state, te, stack);
worldIn.setBlockToAir(pos);
- player.addStat(StatList.getBlockStats(this));
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)
@@ -126,14 +124,16 @@
public int quantityDropped(Random random)
{
- return 0;
+ return 1;
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11)
{
- this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()), Blocks.AIR).isCancelled()) {
+ return;
+ }
worldIn.setBlockToAir(pos);
}
}
@@ -167,6 +167,8 @@
return ((Integer)state.getValue(LAYERS)).intValue() - 1;
}
+ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; }
+
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {LAYERS});