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

44 lines
2.2 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/monster/EntityMob.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntityMob.java
@@ -18,6 +18,7 @@
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
public abstract class EntityMob extends EntityCreature implements IMob
{
@@ -111,7 +112,15 @@
if (j > 0)
{
- entityIn.setFire(j * 4);
+ // entityIn.setFire(j * 4);
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entityIn.getBukkitEntity(), j * 4);
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
+
+ if (!combustEvent.isCancelled()) {
+ entityIn.setFire(combustEvent.getDuration());
+ }
+ // CraftBukkit end
}
if (entityIn instanceof EntityPlayer)
@@ -120,13 +129,13 @@
ItemStack itemstack = this.getHeldItemMainhand();
ItemStack itemstack1 = entityplayer.isHandActive() ? entityplayer.getActiveItemStack() : ItemStack.EMPTY;
- if (!itemstack.isEmpty() && !itemstack1.isEmpty() && itemstack.getItem() instanceof ItemAxe && itemstack1.getItem() == Items.SHIELD)
+ if (!itemstack.isEmpty() && !itemstack1.isEmpty() && itemstack.getItem().canDisableShield(itemstack, itemstack1, entityplayer, this) && itemstack1.getItem().isShield(itemstack1, entityplayer))
{
float f1 = 0.25F + (float)EnchantmentHelper.getEfficiencyModifier(this) * 0.05F;
if (this.rand.nextFloat() < f1)
{
- entityplayer.getCooldownTracker().setCooldown(Items.SHIELD, 100);
+ entityplayer.getCooldownTracker().setCooldown(itemstack1.getItem(), 100);
this.world.setEntityState(entityplayer, (byte)30);
}
}