mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-11 10:12:06 -07:00
Updated against new mc-dev format, takes out quite some casting troubles at the cost of extra ()'s
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user