diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 9de175cb2c..a05206b01a 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -1,14 +1,12 @@ package net.minecraft.server; -// CraftBukkit start -import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.craftbukkit.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.Event.Type; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageByBlockEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; // CraftBukkit end import java.util.List; @@ -221,9 +219,12 @@ public abstract class Entity { if (Z % 20 == 0) { // CraftBukkit start if(this instanceof EntityLiving) { - CraftServer server = ((WorldServer)l).getServer(); + CraftServer server = ((WorldServer) l).getServer(); + org.bukkit.entity.Entity damagee = this.getBukkitEntity(); + DamageCause damageType = EntityDamageEvent.DamageCause.DROWNING; + int damageDone = 1; - EntityDamageEvent ede = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.DROWNING, 1); + EntityDamageEvent ede = new EntityDamageEvent(damagee, damageType, damageDone); server.getPluginManager().callEvent(ede); if (!ede.isCancelled()){ @@ -254,19 +255,30 @@ public abstract class Entity { if (!ae) { // CraftBukkit start if(this instanceof EntityLiving) { - CraftServer server = ((WorldServer)l).getServer(); + CraftServer server = ((WorldServer) l).getServer(); + org.bukkit.entity.Entity damagee = this.getBukkitEntity(); + DamageCause damageType = EntityDamageEvent.DamageCause.LAVA; + int damageDone = 4; - EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(null, this.getBukkitEntity(), EntityDamageEvent.DamageCause.LAVA, 4); + EntityDamageByBlockEvent ede = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone); server.getPluginManager().callEvent(ede); if (!ede.isCancelled()){ a(((Entity) (null)), ede.getDamage()); } - EntityCombustEvent ece = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity()); - server.getPluginManager().callEvent(ece); - if (!ece.isCancelled()){ + if(Z <= 0){ + // not on fire yet + Type eventType = Type.ENTITY_COMBUST; + EntityCombustEvent ece = new EntityCombustEvent(eventType, damagee); + server.getPluginManager().callEvent(ece); + if (!ece.isCancelled()){ + Z = 600; + } + } else { + // reset fire level back to max Z = 600; } + } else { a(((Entity) (null)), 4); Z = 600; @@ -473,9 +485,24 @@ public abstract class Entity { b(1); if (!flag2) { Z++; - if (Z == 0) { + //CraftBukkit start + if(Z <= 0){ + // not on fire yet + CraftServer server = ((WorldServer) l).getServer(); + org.bukkit.entity.Entity damagee = this.getBukkitEntity(); + Type eventType = Type.ENTITY_COMBUST; + + EntityCombustEvent ece = new EntityCombustEvent(eventType, damagee); + server.getPluginManager().callEvent(ece); + + if (!ece.isCancelled()){ + Z = 300; + } + } else { + // reset fire level back to max Z = 300; } + //CraftBukkit end } } else if (Z <= 0) { Z = -Y; @@ -505,9 +532,12 @@ public abstract class Entity { if (!ae) { // CraftBukkit start if(this instanceof EntityLiving) { - CraftServer server = ((WorldServer)l).getServer(); + CraftServer server = ((WorldServer) l).getServer(); + org.bukkit.entity.Entity damagee = this.getBukkitEntity(); + DamageCause damageType = EntityDamageEvent.DamageCause.FIRE; + int damageDone = i1; - EntityDamageEvent ede = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.FIRE, i1); + EntityDamageEvent ede = new EntityDamageEvent(damagee, damageType, damageDone); server.getPluginManager().callEvent(ede); if (!ede.isCancelled()){ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 1940349d90..d05f3d4f07 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -1,12 +1,9 @@ package net.minecraft.server; import java.util.List; -import java.util.Random; //CraftBukkit start import org.bukkit.craftbukkit.entity.CraftArrow; -import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 1cc034709e..9fbb132b7f 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -5,7 +5,6 @@ import java.util.Random; // CraftBukkit start import org.bukkit.Location; -import org.bukkit.craftbukkit.entity.CraftArrow; import org.bukkit.craftbukkit.entity.CraftBoat; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.CraftMappable; diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index fbb7061e6d..610e0e8dd5 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -3,11 +3,7 @@ package net.minecraft.server; import java.util.List; import java.util.Random; -//CraftBukkit start -import org.bukkit.craftbukkit.entity.CraftEgg; -import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftFireball; -import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.event.entity.EntityDamageByProjectileEvent; import org.bukkit.event.entity.EntityDamageEvent; diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java index 532a7e671f..df26fd88a0 100644 --- a/src/main/java/net/minecraft/server/EntityGhast.java +++ b/src/main/java/net/minecraft/server/EntityGhast.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Random; import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftAnimals; import org.bukkit.craftbukkit.entity.CraftGhast; public class EntityGhast extends EntityFlying implements IMobs { diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index f2a7e9d38f..0221012782 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -3,7 +3,6 @@ package net.minecraft.server; import java.util.Random; import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftAnimals; import org.bukkit.craftbukkit.entity.CraftItem; public class EntityItem extends Entity { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index f9e8025718..30bd0ccd43 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Random; import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.entity.CraftAnimals; import org.bukkit.craftbukkit.entity.CraftLivingEntity; public abstract class EntityLiving extends Entity { diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index f78bb2aa80..ef239f550d 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -5,7 +5,6 @@ import java.util.Random; // CraftBukkit start import org.bukkit.Location; -import org.bukkit.craftbukkit.entity.CraftEgg; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftPoweredMinecart; import org.bukkit.craftbukkit.entity.CraftStorageMinecart;