use of resonant.api.explosion.ILauncherController in project ICBM-Classic by BuiltBrokenModding.
the class ItemRadarGun method onItemRightClick.
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (world.isRemote) {
MovingObjectPosition objectMouseOver = player.rayTrace(200, 1);
TileEntity tileEntity = world.getTileEntity(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ);
if (!(tileEntity instanceof ILauncherController)) {
Engine.instance.packetHandler.sendToServer(new PacketPlayerItem(player, objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ));
}
}
return stack;
}
use of resonant.api.explosion.ILauncherController in project ICBM-Classic by BuiltBrokenModding.
the class ItemRadarGun method onItemUse.
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hit_x, float hit_y, float hit_z) {
if (world.isRemote) {
return true;
}
Location location = new Location(world, x, y, z);
TileEntity tile = location.getTileEntity();
if (tile instanceof IMultiTile) {
IMultiTileHost host = ((IMultiTile) tile).getHost();
if (host instanceof TileEntity) {
tile = (TileEntity) host;
}
}
if (player.isSneaking()) {
stack.setTagCompound(null);
stack.setItemDamage(0);
LanguageUtility.addChatToPlayer(player, "gps.cleared");
player.inventoryContainer.detectAndSendChanges();
return true;
} else {
Location storedLocation = getLocation(stack);
if (storedLocation == null || !storedLocation.isAboveBedrock()) {
LanguageUtility.addChatToPlayer(player, "gps.error.pos.invalid");
return true;
} else if (tile instanceof ILauncherController) {
((ILauncherController) tile).setTarget(storedLocation.toPos());
LanguageUtility.addChatToPlayer(player, "gps.data.transferred");
return true;
}
}
return false;
}
use of resonant.api.explosion.ILauncherController in project ICBM-Classic by BuiltBrokenModding.
the class TileLauncherBase method getController.
@Override
public ILauncherController getController() {
for (byte i = 2; i < 6; i++) {
Pos position = new Pos((TileEntity) this).add(ForgeDirection.getOrientation(i));
TileEntity tileEntity = position.getTileEntity(this.worldObj);
if (tileEntity instanceof ILauncherController) {
return (ILauncherController) tileEntity;
}
}
return null;
}
use of resonant.api.explosion.ILauncherController in project ICBM-Classic by BuiltBrokenModding.
the class ItemLaserDetonator method onItemRightClick.
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
if (world.isRemote) {
MovingObjectPosition objectMouseOver = player.rayTrace(200, 1);
TileEntity tileEntity = world.getTileEntity(objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ);
if (!(tileEntity instanceof ILauncherController)) {
Engine.instance.packetHandler.sendToServer(new PacketPlayerItem(player, objectMouseOver.blockX, objectMouseOver.blockY, objectMouseOver.blockZ));
}
}
return stack;
}
Aggregations