ForgePatch/patches/minecraft/net/minecraft/block/BlockSnowLayer.java.patch

55 lines
2.8 KiB
Diff

--- a/net/minecraft/block/BlockSnowLayer.java
+++ b/net/minecraft/block/BlockSnowLayer.java
@@ -84,30 +84,45 @@
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
Integer integer = p_180657_4_.func_177229_b(field_176315_a);
- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
+ net.minecraft.util.NonNullList<ItemStack> items = net.minecraft.util.NonNullList.func_191196_a();
+ int fortune = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_);
+ float chance = 1.0f;
+
+ if (this.canSilkHarvest(p_180657_4_, p_180657_1_, p_180657_3_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
if (integer == 8) {
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_196604_cC));
+ items.add(new ItemStack(Blocks.field_196604_cC));
} else {
for(int i = 0; i < integer; ++i) {
- func_180635_a(p_180657_1_, p_180657_3_, this.func_180643_i(p_180657_4_));
+ items.add(this.func_180643_i(p_180657_4_));
}
}
+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_);
} else {
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Items.field_151126_ay, integer));
+ getDrops(p_180657_4_, items, p_180657_1_, p_180657_3_, fortune);
+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, fortune, 1.0f, false, p_180657_2_);
}
+ for (ItemStack item : items) {
+ if (p_180657_1_.field_73012_v.nextFloat() <= chance)
+ func_180635_a(p_180657_1_, p_180657_3_, item);
+ }
+
p_180657_1_.func_175698_g(p_180657_3_);
p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));
p_180657_2_.func_71020_j(0.005F);
}
public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) {
- return Items.field_190931_a;
+ return Items.field_151126_ay;
}
+ @Override
+ public int func_196264_a(IBlockState state, Random random) {
+ return state.func_177229_b(field_176315_a) + 1;
+ }
+
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
if (p_196267_2_.func_175642_b(EnumLightType.BLOCK, p_196267_3_) > 11) {
- p_196267_1_.func_196949_c(p_196267_2_, p_196267_3_, 0);
p_196267_2_.func_175698_g(p_196267_3_);
}