mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 05:40:00 +03:00
68 lines
3.1 KiB
Diff
68 lines
3.1 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySnowman.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySnowman.java
|
|
@@ -30,8 +30,9 @@
|
|
import net.minecraft.util.math.MathHelper;
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.world.storage.loot.LootTableList;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
-public class EntitySnowman extends EntityGolem implements IRangedAttackMob
|
|
+public class EntitySnowman extends EntityGolem implements IRangedAttackMob, net.minecraftforge.common.IShearable
|
|
{
|
|
private static final DataParameter<Byte> PUMPKIN_EQUIPPED = EntityDataManager.<Byte>createKey(EntitySnowman.class, DataSerializers.BYTE);
|
|
|
|
@@ -101,10 +102,12 @@
|
|
|
|
if (this.world.getBiome(new BlockPos(i, 0, k)).getTemperature(new BlockPos(i, j, k)) > 1.0F)
|
|
{
|
|
- this.attackEntityFrom(DamageSource.ON_FIRE, 1.0F);
|
|
+ // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
|
|
+ // this.attackEntityFrom(DamageSource.ON_FIRE, 1.0F);
|
|
+ this.attackEntityFrom(CraftEventFactory.MELTING, 1.0F);
|
|
}
|
|
|
|
- if (!this.world.getGameRules().getBoolean("mobGriefing"))
|
|
+ if (!net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this))
|
|
{
|
|
return;
|
|
}
|
|
@@ -118,7 +121,8 @@
|
|
|
|
if (this.world.getBlockState(blockpos).getMaterial() == Material.AIR && this.world.getBiome(blockpos).getTemperature(blockpos) < 0.8F && Blocks.SNOW_LAYER.canPlaceBlockAt(this.world, blockpos))
|
|
{
|
|
- this.world.setBlockState(blockpos, Blocks.SNOW_LAYER.getDefaultState());
|
|
+ // this.world.setBlockState(blockpos, Blocks.SNOW_LAYER.getDefaultState());
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.world, blockpos, Blocks.SNOW_LAYER.getDefaultState(), this);
|
|
}
|
|
}
|
|
}
|
|
@@ -148,11 +152,12 @@
|
|
return 1.7F;
|
|
}
|
|
|
|
+ // TODO: Implement PlayerShearEntityEvent
|
|
protected boolean processInteract(EntityPlayer player, EnumHand hand)
|
|
{
|
|
ItemStack itemstack = player.getHeldItem(hand);
|
|
|
|
- if (itemstack.getItem() == Items.SHEARS && this.isPumpkinEquipped() && !this.world.isRemote)
|
|
+ if (false && itemstack.getItem() == Items.SHEARS && this.isPumpkinEquipped() && !this.world.isRemote) //Forge: Moved to onSheared
|
|
{
|
|
this.setPumpkinEquipped(false);
|
|
itemstack.damageItem(1, player);
|
|
@@ -198,6 +203,14 @@
|
|
return SoundEvents.ENTITY_SNOWMAN_DEATH;
|
|
}
|
|
|
|
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos) { return this.isPumpkinEquipped(); }
|
|
+ @Override
|
|
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
|
|
+ {
|
|
+ this.setPumpkinEquipped(false);
|
|
+ return com.google.common.collect.Lists.newArrayList();
|
|
+ }
|
|
+
|
|
public void setSwingingArms(boolean swingingArms)
|
|
{
|
|
}
|