ForgePatch/patches/common/net/minecraft/src/EntityMooshroom.java.patch
LexManos 31a908b754 More patches converted.
Refactored some of the events to be a better hiarachy.
2012-08-06 15:07:53 -07:00

77 lines
2.6 KiB
Diff

--- ../src_base/common/net/minecraft/src/EntityMooshroom.java
+++ ../src_work/common/net/minecraft/src/EntityMooshroom.java
@@ -1,6 +1,10 @@
package net.minecraft.src;
-public class EntityMooshroom extends EntityCow
+import java.util.ArrayList;
+
+import net.minecraftforge.common.IShearable;
+
+public class EntityMooshroom extends EntityCow implements IShearable
{
public EntityMooshroom(World par1World)
{
@@ -31,31 +35,7 @@
}
}
- if (var2 != null && var2.itemID == Item.shears.shiftedIndex && this.getGrowingAge() >= 0)
- {
- this.setDead();
- this.worldObj.spawnParticle("largeexplode", this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D);
-
- if (!this.worldObj.isRemote)
- {
- EntityCow var3 = new EntityCow(this.worldObj);
- var3.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
- var3.setEntityHealth(this.getHealth());
- var3.renderYawOffset = this.renderYawOffset;
- this.worldObj.spawnEntityInWorld(var3);
-
- for (int var4 = 0; var4 < 5; ++var4)
- {
- this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Block.mushroomRed)));
- }
- }
-
- return true;
- }
- else
- {
- return super.interact(par1EntityPlayer);
- }
+ return super.interact(par1EntityPlayer);
}
/**
@@ -65,4 +45,29 @@
{
return new EntityMooshroom(this.worldObj);
}
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z)
+ {
+ return getGrowingAge() >= 0;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune)
+ {
+ setDead();
+ EntityCow entitycow = new EntityCow(worldObj);
+ entitycow.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
+ entitycow.setEntityHealth(getHealth());
+ entitycow.renderYawOffset = renderYawOffset;
+ worldObj.spawnEntityInWorld(entitycow);
+ worldObj.spawnParticle("largeexplode", posX, posY + (double)(height / 2.0F), posZ, 0.0D, 0.0D, 0.0D);
+
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ for (int x = 0; x < 5; x++)
+ {
+ ret.add(new ItemStack(Block.mushroomRed));
+ }
+ return ret;
+ }
}