69 lines
2.3 KiB
Diff
69 lines
2.3 KiB
Diff
--- ../src_base/common/net/minecraft/src/EntitySheep.java
|
|
+++ ../src_work/common/net/minecraft/src/EntitySheep.java
|
|
@@ -2,9 +2,13 @@
|
|
|
|
import cpw.mods.fml.common.Side;
|
|
import cpw.mods.fml.common.asm.SideOnly;
|
|
+
|
|
+import java.util.ArrayList;
|
|
import java.util.Random;
|
|
|
|
-public class EntitySheep extends EntityAnimal
|
|
+import net.minecraftforge.common.IShearable;
|
|
+
|
|
+public class EntitySheep extends EntityAnimal implements IShearable
|
|
{
|
|
/**
|
|
* Holds the RGB table of the sheep colors - in OpenGL glColor3f values - used to render the sheep colored fleece.
|
|
@@ -134,27 +138,6 @@
|
|
*/
|
|
public boolean interact(EntityPlayer par1EntityPlayer)
|
|
{
|
|
- ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
|
|
-
|
|
- if (var2 != null && var2.itemID == Item.shears.shiftedIndex && !this.getSheared() && !this.isChild())
|
|
- {
|
|
- if (!this.worldObj.isRemote)
|
|
- {
|
|
- this.setSheared(true);
|
|
- int var3 = 1 + this.rand.nextInt(3);
|
|
-
|
|
- for (int var4 = 0; var4 < var3; ++var4)
|
|
- {
|
|
- EntityItem var5 = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F);
|
|
- var5.motionY += (double)(this.rand.nextFloat() * 0.05F);
|
|
- var5.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
|
|
- var5.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
|
|
- }
|
|
- }
|
|
-
|
|
- var2.damageItem(1, par1EntityPlayer);
|
|
- }
|
|
-
|
|
return super.interact(par1EntityPlayer);
|
|
}
|
|
|
|
@@ -287,4 +270,23 @@
|
|
this.setGrowingAge(var1);
|
|
}
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z)
|
|
+ {
|
|
+ return !getSheared() && !isChild();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune)
|
|
+ {
|
|
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
|
+ setSheared(true);
|
|
+ int i = 1 + rand.nextInt(3);
|
|
+ for (int j = 0; j < i; j++)
|
|
+ {
|
|
+ ret.add(new ItemStack(Block.cloth.blockID, 1, getFleeceColor()));
|
|
+ }
|
|
+ return ret;
|
|
+ }
|
|
}
|