}
}
}
// Overridden methods
if (method.getName().equals("a") && Arrays.deepEquals(method.getParameterTypes(), new Class[] {IBlockAccess.class, int.class, int.class, int.class, int.class})) {
World world = (World) args[0];
int x = (Integer) args[1];
int y = (Integer) args[2];
int z = (Integer) args[3];
int face = (Integer) args[4];
org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
if (block != null) {
return block.isProvidingPowerTo(world.getWorld(), x, y, z, org.bukkit.craftbukkit.v1_6_R3.block.CraftBlock.notchToBlockFace(face));
}
} else if (method.getName().equals("c") && Arrays.deepEquals(method.getParameterTypes(), new Class[] {World.class, int.class, int.class, int.class, int.class})) {
World world = (World) args[0];
int x = (Integer) args[1];
int y = (Integer) args[2];
int z = (Integer) args[3];
int face = (Integer) args[4];
org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
if (block != null) {
return block.isProvidingPowerTo(world.getWorld(), x, y, z, org.bukkit.craftbukkit.v1_6_R3.block.CraftBlock.notchToBlockFace(face));
}
} else if (method.getName().equals("b") && Arrays.deepEquals(method.getParameterTypes(), new Class[] {World.class, int.class, int.class, int.class, Entity.class})) {
World world = (World) args[0];
int x = (Integer) args[1];
int y = (Integer) args[2];
int z = (Integer) args[3];
Entity e = (Entity) args[4];
org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
if (block != null) {
block.onEntityMoveAt(world.getWorld(), x, y, z, e.getBukkitEntity());
return null;
}
} else if (method.getName().equals("interact")) {
World world = (World) args[0];
int x = (Integer) args[1];
int y = (Integer) args[2];
int z = (Integer) args[3];
Entity human = (Entity) args[4];
org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
if (block != null && human instanceof EntityPlayer) {
return block.onBlockInteract(world.getWorld(), x, y, z, ((SpoutPlayer) human.getBukkitEntity()));
}
} else if (method.getName().equals("getDamage")) {
EntityHuman human = (EntityHuman) args[0];
World world = (World) args[1];
int x = (Integer) args[2];
int y = (Integer) args[3];
int z = (Integer) args[4];
org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
if (block != null) {
if (block instanceof org.getspout.spoutapi.material.CustomBlock) {
SpoutPlayer player = (SpoutPlayer) human.getBukkitEntity();
float def;
SpoutItemStack inHand = player.getItemInHand() == null ? null : new SpoutItemStack(player.getItemInHand());
org.getspout.spoutapi.material.Material item = inHand.getMaterial();
float hardness = block.getHardness();
if (hardness <= 0F) {
return m.invoke(wrapped, args);
}
def = (!human.a(wrapped) ? 1.0F / hardness / 100.0F : human.a(wrapped, false) / hardness / 30.0F); //TODO EntityHuman.a(Block, boolean) appears to not make any use of the flag variable...
if (!(item instanceof CustomItem)) {
return def;
}
if (!(item instanceof Tool)) {
return def;
}
Tool tool = (Tool) item;
float modifier = tool.getStrengthModifier(block);
return modifier / hardness / (modifier > 1F ? 30F : 100F);
}
}
} else if (method.getName().equals("remove")) {
World world = (World) args[0];
int x = (Integer) args[1];
int y = (Integer) args[2];
int z = (Integer) args[3];
org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
if (block != null) {
block.onBlockDestroyed(world.getWorld(), x, y, z);
}
} else if (method.getName().equals("doPhysics")) {
World world = (World) args[0];
int x = (Integer) args[1];
int y = (Integer) args[2];
int z = (Integer) args[3];
int face = (Integer) args[4];
org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
if (block != null) {
block.onNeighborBlockChange(world.getWorld(), x, y, z, face);
}
}
return m.invoke(wrapped, args);
}