Files
2019-02-24 22:29:41 +08:00

65 lines
2.6 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/passive/EntityMooshroom.java
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityMooshroom.java
@@ -16,7 +16,7 @@
import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootTableList;
-public class EntityMooshroom extends EntityCow
+public class EntityMooshroom extends EntityCow implements net.minecraftforge.common.IShearable
{
public EntityMooshroom(World worldIn)
{
@@ -30,6 +30,7 @@
EntityLiving.registerFixesMob(fixer, EntityMooshroom.class);
}
+ // TODO: Implement PlayerShearEntityEvent
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
ItemStack itemstack = player.getHeldItem(hand);
@@ -49,7 +50,7 @@
return true;
}
- else if (itemstack.getItem() == Items.SHEARS && this.getGrowingAge() >= 0)
+ else if (false && itemstack.getItem() == Items.SHEARS && this.getGrowingAge() >= 0) //Forge Disable, Moved to onSheared
{
this.setDead();
this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D);
@@ -90,6 +91,35 @@
return new EntityMooshroom(this.world);
}
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos){ return getGrowingAge() >= 0; }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, net.minecraft.util.math.BlockPos pos, int fortune)
+ {
+ this.setDead();
+ ((net.minecraft.world.WorldServer)this.world).spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, false, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 1, 0.0D, 0.0D, 0.0D, 0.0D);
+
+ EntityCow entitycow = new EntityCow(this.world);
+ entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
+ entitycow.setHealth(this.getHealth());
+ entitycow.renderYawOffset = this.renderYawOffset;
+
+ if (this.hasCustomName())
+ {
+ entitycow.setCustomNameTag(this.getCustomNameTag());
+ }
+
+ this.world.spawnEntity(entitycow);
+
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ for (int i = 0; i < 5; ++i)
+ {
+ ret.add(new ItemStack(Blocks.RED_MUSHROOM));
+ }
+
+ this.playSound(SoundEvents.ENTITY_MOOSHROOM_SHEAR, 1.0F, 1.0F);
+ return ret;
+ }
+
@Nullable
protected ResourceLocation getLootTable()
{