Updated against new mc-dev format, takes out quite some casting troubles at the cost of extra ()'s

This commit is contained in:
Erik Broes
2011-01-11 09:25:13 +01:00
parent 75654e8db5
commit 22dab8e985
44 changed files with 770 additions and 817 deletions

View File

@@ -1,5 +1,6 @@
package net.minecraft.server;
// CraftBukkit start
import org.bukkit.LivingEntity;
import org.bukkit.craftbukkit.CraftBlock;
import org.bukkit.craftbukkit.CraftEntity;
@@ -7,6 +8,7 @@ import org.bukkit.craftbukkit.CraftLivingEntity;
import org.bukkit.craftbukkit.CraftPlayer;
import org.bukkit.event.entity.EntityDamagedByBlockEvent;
import org.bukkit.event.entity.EntityDamagedEvent;
// CraftBukkit end
import java.util.Random;
@@ -93,23 +95,22 @@ public class BlockCactus extends Block {
}
public void a(World world, int i, int j, int k, Entity entity) {
// Craftbukkit: ENTITY_DAMAGEBY_BLOCK event
// CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event
CraftEntity toPassIn = null;
if(entity instanceof EntityPlayerMP)
{
toPassIn = new CraftPlayer(((WorldServer)world).getServer(), (EntityPlayerMP)entity);
} else if(entity instanceof EntityLiving)
{
toPassIn = new CraftLivingEntity(((WorldServer)world).getServer(), (EntityLiving)entity);
if (entity instanceof EntityPlayerMP) {
toPassIn = new CraftPlayer(((WorldServer) world).getServer(), (EntityPlayerMP) entity);
} else if (entity instanceof EntityLiving) {
toPassIn = new CraftLivingEntity(((WorldServer) world).getServer(), (EntityLiving) entity);
}
if(toPassIn != null)
{
EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(((WorldServer)world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamagedEvent.DamageCause.CONTACT, 1);
((WorldServer)world).getServer().getPluginManager().callEvent(edbbe);
if(edbbe.isCancelled()) return;
if(toPassIn != null) {
EntityDamagedByBlockEvent edbbe = new EntityDamagedByBlockEvent(((WorldServer) world).getWorld().getBlockAt(i, j, k), toPassIn, EntityDamagedEvent.DamageCause.CONTACT, 1);
((WorldServer) world).getServer().getPluginManager().callEvent(edbbe);
if (edbbe.isCancelled())
return;
}
// Craftbukkit TODO: Other entities (when their respective classes are added) hitting a Cactus
entity.a(null, 1);
// CraftBukkit end TODO: Other entities (when their respective classes are added) hitting a Cactus
entity.a(((Entity) (null)), 1);
}
}