ForgePatch/forge/patches/minecraft_server/net/minecraft/src/EntityMooshroom.java.patch

73 lines
2.8 KiB
Diff
Raw Normal View History

--- ../src_base/minecraft_server/net/minecraft/src/EntityMooshroom.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityMooshroom.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,10 @@
package net.minecraft.src;
-public class EntityMooshroom extends EntityCow
+import java.util.ArrayList;
+
+import net.minecraft.src.forge.IShearable;
+
+public class EntityMooshroom extends EntityCow implements IShearable
{
public EntityMooshroom(World par1World)
{
2012-03-07 17:45:31 +00:00
@@ -21,27 +25,6 @@
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, new ItemStack(Item.bowlSoup));
return true;
}
2012-03-07 17:45:31 +00:00
- else if (var2 != null && var2.itemID == Item.shears.shiftedIndex && this.getGrowingAge() >= 0)
- {
- this.setEntityDead();
- 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.getEntityHealth());
- 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;
- }
2012-03-07 17:45:31 +00:00
else
{
return super.interact(par1EntityPlayer);
@@ -55,4 +38,29 @@
{
return new EntityMooshroom(this.worldObj);
}
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z)
+ {
2012-03-07 17:45:31 +00:00
+ return getGrowingAge() >= 0;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune)
+ {
+ setEntityDead();
+ EntityCow entitycow = new EntityCow(worldObj);
+ entitycow.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
+ entitycow.setEntityHealth(getEntityHealth());
+ 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;
+ }
}