use of mods.railcraft.api.core.items.IToolCrowbar in project Railcraft by Railcraft.
the class TrackKitLauncher method blockActivated.
@Override
public boolean blockActivated(EntityPlayer player, EnumHand hand, ItemStack heldItem) {
if (!InvTools.isEmpty(heldItem) && heldItem.getItem() instanceof IToolCrowbar) {
IToolCrowbar crowbar = (IToolCrowbar) heldItem.getItem();
if (crowbar.canWhack(player, hand, heldItem, getPos())) {
GuiHandler.openGui(EnumGui.TRACK_LAUNCHER, player, theWorldAsserted(), getPos().getX(), getPos().getY(), getPos().getZ());
crowbar.onWhack(player, hand, heldItem, getPos());
return true;
}
}
return false;
}
use of mods.railcraft.api.core.items.IToolCrowbar in project Railcraft by Railcraft.
the class BlockWorldspikePoint method onBlockActivated.
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
if (heldItem != null && heldItem.getItem() instanceof IToolCrowbar) {
IToolCrowbar crowbar = (IToolCrowbar) heldItem.getItem();
if (crowbar.canWhack(player, hand, heldItem, pos)) {
WorldCoordinate ourCoord = new WorldCoordinate(world.provider.getDimension(), pos);
WorldCoordinate target = TileWorldspike.getTarget(player);
if (target == null)
TileWorldspike.setTarget(ourCoord, player, getUnlocalizedName());
else if (world.provider.getDimension() != target.getDim())
ChatPlugin.sendLocalizedChatFromServer(player, "gui.railcraft.worldspike.pair.fail.dimension", getUnlocalizedName());
else if (ourCoord.equals(target)) {
TileWorldspike.removeTarget(player);
ChatPlugin.sendLocalizedChatFromServer(player, "gui.railcraft.worldspike.pair.cancel", getUnlocalizedName());
} else {
if (TileWorldspike.isTargetLoaded(player, target, getUnlocalizedName())) {
TileEntity tile = WorldPlugin.getBlockTile(world, target.getPos());
if (tile instanceof TileWorldspike)
((TileWorldspike) tile).setPoint(player, ourCoord);
else if (tile != null)
ChatPlugin.sendLocalizedChatFromServer(player, "gui.railcraft.worldspike.pair.fail.invalid", getUnlocalizedName());
}
}
crowbar.onWhack(player, hand, heldItem, pos);
return true;
}
}
return false;
}
use of mods.railcraft.api.core.items.IToolCrowbar in project Railcraft by Railcraft.
the class TileWorldspike method blockActivated.
@Override
public boolean blockActivated(EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
if (heldItem != null && heldItem.getItem() instanceof IToolCrowbar) {
IToolCrowbar crowbar = (IToolCrowbar) heldItem.getItem();
if (crowbar.canWhack(player, hand, heldItem, getPos())) {
if (Game.isHost(worldObj)) {
WorldCoordinate ourCoord = new WorldCoordinate(this);
WorldCoordinate target = pointPairingMap.get(player);
if (target == null)
setTarget(ourCoord, player, getLocalizationTag());
else if (worldObj.provider.getDimension() != target.getDim())
ChatPlugin.sendLocalizedChatFromServer(player, "gui.railcraft.worldspike.pair.fail.dimension", getLocalizationTag());
else if (Objects.equals(ourCoord, target)) {
removeTarget(player);
ChatPlugin.sendLocalizedChatFromServer(player, "gui.railcraft.worldspike.pair.cancel", getLocalizationTag());
} else
setPoint(player, target);
crowbar.onWhack(player, hand, heldItem, getPos());
}
return true;
}
}
return super.blockActivated(player, hand, heldItem, side, hitX, hitY, hitZ);
}
Aggregations