mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 04:32:15 +00:00
172 lines
6.5 KiB
Diff
172 lines
6.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
|
|
@@ -2,6 +2,7 @@
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
+import java.util.ArrayList;
|
|
import java.util.Random;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
@@ -15,8 +16,9 @@
|
|
import net.minecraft.world.ColorizerFoliage;
|
|
import net.minecraft.world.IBlockAccess;
|
|
import net.minecraft.world.World;
|
|
+import net.minecraftforge.common.IShearable;
|
|
|
|
-public abstract class BlockLeaves extends BlockLeavesBase
|
|
+public abstract class BlockLeaves extends BlockLeavesBase implements IShearable
|
|
{
|
|
int[] field_150128_a;
|
|
@SideOnly(Side.CLIENT)
|
|
@@ -82,10 +84,10 @@
|
|
{
|
|
for (int l1 = -b0; l1 <= b0; ++l1)
|
|
{
|
|
- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j)
|
|
+ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
|
|
+ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1))
|
|
{
|
|
- int i2 = p_149749_1_.func_72805_g(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
|
|
- p_149749_1_.func_72921_c(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4);
|
|
+ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
|
|
}
|
|
}
|
|
}
|
|
@@ -127,9 +129,9 @@
|
|
{
|
|
Block block = p_149674_1_.func_147439_a(p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2);
|
|
|
|
- if (block != Blocks.field_150364_r && block != Blocks.field_150363_s)
|
|
+ if (!block.canSustainLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2))
|
|
{
|
|
- if (block.func_149688_o() == Material.field_151584_j)
|
|
+ if (block.isLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2))
|
|
{
|
|
this.field_150128_a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
|
|
}
|
|
@@ -236,40 +238,7 @@
|
|
|
|
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
|
|
{
|
|
- if (!p_149690_1_.field_72995_K)
|
|
- {
|
|
- int j1 = this.func_150123_b(p_149690_5_);
|
|
-
|
|
- if (p_149690_7_ > 0)
|
|
- {
|
|
- j1 -= 2 << p_149690_7_;
|
|
-
|
|
- if (j1 < 10)
|
|
- {
|
|
- j1 = 10;
|
|
- }
|
|
- }
|
|
-
|
|
- if (p_149690_1_.field_73012_v.nextInt(j1) == 0)
|
|
- {
|
|
- Item item = this.func_149650_a(p_149690_5_, p_149690_1_.field_73012_v, p_149690_7_);
|
|
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(item, 1, this.func_149692_a(p_149690_5_)));
|
|
- }
|
|
-
|
|
- j1 = 200;
|
|
-
|
|
- if (p_149690_7_ > 0)
|
|
- {
|
|
- j1 -= 10 << p_149690_7_;
|
|
-
|
|
- if (j1 < 40)
|
|
- {
|
|
- j1 = 40;
|
|
- }
|
|
- }
|
|
-
|
|
- this.func_150124_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, j1);
|
|
- }
|
|
+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, 1.0f, p_149690_7_);
|
|
}
|
|
|
|
protected void func_150124_c(World p_150124_1_, int p_150124_2_, int p_150124_3_, int p_150124_4_, int p_150124_5_, int p_150124_6_) {}
|
|
@@ -281,13 +250,7 @@
|
|
|
|
public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
|
|
{
|
|
- if (!p_149636_1_.field_72995_K && p_149636_2_.func_71045_bC() != null && p_149636_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ)
|
|
{
|
|
- p_149636_2_.func_71064_a(StatList.field_75934_C[Block.func_149682_b(this)], 1);
|
|
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Item.func_150898_a(this), 1, p_149636_6_ & 3));
|
|
- }
|
|
- else
|
|
- {
|
|
super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
|
|
}
|
|
}
|
|
@@ -318,4 +281,67 @@
|
|
}
|
|
|
|
public abstract String[] func_150125_e();
|
|
+
|
|
+
|
|
+ @Override
|
|
+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
|
|
+ {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
|
|
+ {
|
|
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
|
+ ret.add(new ItemStack(this, 1, world.func_72805_g(x, y, z) & 3));
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void beginLeavesDecay(World world, int x, int y, int z)
|
|
+ {
|
|
+
|
|
+ int i2 = world.func_72805_g(x, y, z);
|
|
+
|
|
+ if ((i2 & 8) == 0)
|
|
+ {
|
|
+ world.func_72921_c(x, y, z, i2 | 8, 4);
|
|
+ }
|
|
+ world.func_72921_c(x, y, z, world.func_72805_g(x, y, z) | 8, 4);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isLeaves(IBlockAccess world, int x, int y, int z)
|
|
+ {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
+
|
|
+ @Override
|
|
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
|
+ {
|
|
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
|
+ int chance = this.func_150123_b(metadata);
|
|
+
|
|
+ if (fortune > 0)
|
|
+ {
|
|
+ chance -= 2 << fortune;
|
|
+ if (chance < 10) chance = 10;
|
|
+ }
|
|
+
|
|
+ if (world.field_73012_v.nextInt(chance) == 0)
|
|
+ ret.add(new ItemStack(this.func_149650_a(metadata, world.field_73012_v, fortune), 1, this.func_149692_a(metadata)));
|
|
+
|
|
+ chance = 200;
|
|
+ if (fortune > 0)
|
|
+ {
|
|
+ chance -= 10 << fortune;
|
|
+ if (chance < 40) chance = 40;
|
|
+ }
|
|
+
|
|
+ this.captureDrops(true);
|
|
+ this.func_150124_c(world, x, y, z, metadata, chance); // Dammet mojang
|
|
+ ret.addAll(this.captureDrops(false));
|
|
+ return ret;
|
|
+ }
|
|
}
|