use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.
the class BlockCageTrap method onEntityCollidedWithBlock.
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
if (par1World.isRemote) {
return;
} else {
if (par5Entity instanceof EntityPlayer && !deactivated) {
par1World.setBlock(par2, par3, par4, mod_SecurityCraft.deactivatedCageTrap);
par1World.scheduleBlockUpdate(par2, par3, par4, mod_SecurityCraft.unbreakableIronBars, 1200);
par1World.setBlock(par2, par3 + 4, par4, mod_SecurityCraft.unbreakableIronBars);
par1World.scheduleBlockUpdate(par2, par3 + 4, par4, mod_SecurityCraft.unbreakableIronBars, 1200);
par1World.setBlock(par2 + 1, par3 + 4, par4, mod_SecurityCraft.unbreakableIronBars);
par1World.scheduleBlockUpdate(par2 + 1, par3 + 4, par4, mod_SecurityCraft.unbreakableIronBars, 1200);
par1World.setBlock(par2 - 1, par3 + 4, par4, mod_SecurityCraft.unbreakableIronBars);
par1World.scheduleBlockUpdate(par2 - 1, par3 + 4, par4, mod_SecurityCraft.unbreakableIronBars, 1200);
par1World.setBlock(par2, par3 + 4, par4 + 1, mod_SecurityCraft.unbreakableIronBars);
par1World.scheduleBlockUpdate(par2, par3 + 4, par4 + 1, mod_SecurityCraft.unbreakableIronBars, 1200);
par1World.setBlock(par2, par3 + 4, par4 - 1, mod_SecurityCraft.unbreakableIronBars);
par1World.scheduleBlockUpdate(par2, par3 + 4, par4 - 1, mod_SecurityCraft.unbreakableIronBars, 1200);
HelpfulMethods.setBlockInBox(par1World, par2, par3, par4, mod_SecurityCraft.unbreakableIronBars);
par1World.playSoundAtEntity(par5Entity, "random.anvil_use", 3.0F, 1.0F);
// ChatMessageComponent.createFromText(((EntityPlayer) par5Entity).getCommandSenderName() + " was captured in a trap at" + HelpfulMethods.getFormattedCoordinates(par2, par3, par4))
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentTranslation(((EntityPlayer) par5Entity).getCommandSenderName() + " was captured in a trap at" + HelpfulMethods.getFormattedCoordinates(par2, par3, par4)));
}
}
}
use of net.minecraft.util.ChatComponentTranslation in project SecurityCraft by Geforce132.
the class SCIRCBot method sendMessageToPlayer.
private void sendMessageToPlayer(String par1String, EntityPlayer par2EntityPlayer) {
ChatComponentTranslation component = new ChatComponentTranslation(par1String, new Object[0]);
par2EntityPlayer.addChatComponentMessage(component);
}
use of net.minecraft.util.ChatComponentTranslation in project NyaSamaRailway by NSDN.
the class Connector method onItemUseFirst.
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
Block block = world.getBlock(x, y, z);
if (block == null)
return false;
if (!world.isRemote) {
if (player.isSneaking()) {
UUID uuid = player.getUniqueID();
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityTransceiver) {
TileEntityTransceiver railSender = (TileEntityTransceiver) tileEntity;
if (tmpRails.containsKey(uuid)) {
tmpRails.remove(uuid);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.abort"));
} else {
tmpRails.put(uuid, railSender);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.begin"));
}
return true;
} else if (tileEntity instanceof TileEntityReceiver) {
TileEntityReceiver railReceiver = (TileEntityReceiver) tileEntity;
if (tmpRails.containsKey(uuid)) {
if (railReceiver.getSender() != tmpRails.get(uuid)) {
if (tmpRails.get(uuid).getTransceiver() == null) {
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.error"));
} else {
railReceiver.setSender(tmpRails.get(uuid));
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.connected"));
updateTileEntity(tmpRails.get(uuid));
updateTileEntity(railReceiver);
}
tmpRails.remove(uuid);
} else {
if (railReceiver.getSender() == tmpRails.get(uuid)) {
railReceiver.setSender(null);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.disconnected"));
updateTileEntity(tmpRails.get(uuid));
updateTileEntity(railReceiver);
tmpRails.remove(uuid);
}
}
} else {
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.error"));
}
return true;
}
} else {
UUID uuid = player.getUniqueID();
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityMultiSender) {
TileEntityMultiSender sender = (TileEntityMultiSender) tileEntity;
if (senderRails.containsKey(uuid)) {
if (senderRails.get(uuid) instanceof TileEntityMultiSender) {
if (senderRails.get(uuid) == sender) {
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.abort"));
} else {
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.error"));
}
} else {
if (sender.getTransceiver() == senderRails.get(uuid)) {
sender.getTransceiver().setTransceiver(null);
sender.setTransceiver(null);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.disconnected"));
updateTileEntity(senderRails.get(uuid));
updateTileEntity(sender);
} else {
sender.setTransceiver(senderRails.get(uuid));
sender.getTransceiver().setTransceiver(sender);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.connected"));
updateTileEntity(senderRails.get(uuid));
updateTileEntity(sender);
}
}
senderRails.remove(uuid);
} else {
if (receiverRails.containsKey(uuid)) {
// Here is actuator to transceiver, 1 to 1
if (receiverRails.get(uuid) instanceof TileEntityActuator) {
TileEntityActuator actuator = (TileEntityActuator) receiverRails.get(uuid);
if (actuator.getTarget() != sender) {
actuator.setTarget(sender);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.connected"));
updateTileEntity(actuator);
updateTileEntity(sender);
} else {
actuator.setTarget(null);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.disconnected"));
updateTileEntity(actuator);
updateTileEntity(sender);
}
} else {
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.error"));
}
receiverRails.remove(uuid);
} else {
senderRails.put(uuid, sender);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.begin"));
}
}
return true;
} else if (tileEntity instanceof TileEntityTransceiver) {
TileEntityTransceiver transceiver = (TileEntityTransceiver) tileEntity;
if (senderRails.containsKey(uuid)) {
if (senderRails.get(uuid) instanceof TileEntityMultiSender) {
if (transceiver.getTransceiver() == senderRails.get(uuid)) {
transceiver.getTransceiver().setTransceiver(null);
transceiver.setTransceiver(null);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.disconnected"));
updateTileEntity(senderRails.get(uuid));
updateTileEntity(transceiver);
} else {
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.error"));
}
} else {
// Here is blocking rail, link with 1n4148 instead of this item, it may be dangerous
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.abort"));
}
senderRails.remove(uuid);
} else {
senderRails.put(uuid, transceiver);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.begin"));
}
return true;
} else if (tileEntity instanceof TileEntityReceiver) {
TileEntityReceiver receiver = (TileEntityReceiver) tileEntity;
if (senderRails.containsKey(uuid)) {
if (receiver.getSender() != senderRails.get(uuid)) {
receiver.setSender(senderRails.get(uuid));
if (senderRails.get(uuid) instanceof TileEntityMultiSender) {
((TileEntityMultiSender) senderRails.get(uuid)).incTarget();
}
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.connected"));
updateTileEntity(senderRails.get(uuid));
updateTileEntity(receiver);
} else {
receiver.setSender(null);
if (senderRails.get(uuid) instanceof TileEntityMultiSender) {
((TileEntityMultiSender) senderRails.get(uuid)).decTarget();
}
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.disconnected"));
updateTileEntity(senderRails.get(uuid));
updateTileEntity(receiver);
}
senderRails.remove(uuid);
} else {
if (receiverRails.containsKey(uuid)) {
if (receiverRails.get(uuid) instanceof TileEntityActuator) {
TileEntityActuator actuator = (TileEntityActuator) receiverRails.get(uuid);
if (actuator == receiver) {
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.abort"));
} else if (actuator.getTarget() != receiver) {
actuator.setTarget(receiver);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.connected"));
updateTileEntity(actuator);
updateTileEntity(receiver);
} else {
actuator.setTarget(null);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.disconnected"));
updateTileEntity(actuator);
updateTileEntity(receiver);
}
} else if (receiver instanceof TileEntityActuator) {
if (((TileEntityActuator) receiver).getTarget() != receiverRails.get(uuid)) {
((TileEntityActuator) receiver).setTarget(receiverRails.get(uuid));
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.connected"));
updateTileEntity(receiverRails.get(uuid));
updateTileEntity(receiver);
} else {
((TileEntityActuator) receiver).setTarget(null);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.disconnected"));
updateTileEntity(receiverRails.get(uuid));
updateTileEntity(receiver);
}
}
receiverRails.remove(uuid);
} else {
if (receiver instanceof TileEntityPassiveReceiver) {
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.error"));
} else {
receiverRails.put(uuid, receiver);
if (player instanceof EntityPlayerMP)
player.addChatComponentMessage(new ChatComponentTranslation("info.signal.begin"));
}
}
}
return true;
} else {
onConnectorUseLast(player, uuid, tileEntity);
}
}
}
return false;
}
use of net.minecraft.util.ChatComponentTranslation in project NyaSamaRailway by NSDN.
the class DevEditor method onItemUseFirst.
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
UUID uuid = player.getUniqueID();
if (!world.isRemote) {
if (tileEntity == null) {
if (sender.containsKey(uuid))
sender.remove(uuid);
if (target.containsKey(uuid))
target.remove(uuid);
player.addChatComponentMessage(new ChatComponentTranslation("info.editor.clear"));
return true;
}
if (player.isSneaking()) {
if (!target.containsKey(uuid)) {
if (tileEntity instanceof TileEntityActuator) {
target.put(uuid, ((TileEntityActuator) tileEntity).getTarget());
player.addChatComponentMessage(new ChatComponentTranslation("info.editor.copy.target"));
} else {
player.addChatComponentMessage(new ChatComponentTranslation("info.editor.error"));
}
} else {
if (tileEntity instanceof TileEntityActuator) {
((TileEntityActuator) tileEntity).setTarget(target.get(uuid));
world.markBlockForUpdate(x, y, z);
player.addChatComponentMessage(new ChatComponentTranslation("info.editor.paste.target"));
} else {
player.addChatComponentMessage(new ChatComponentTranslation("info.editor.error"));
}
}
} else {
if (!sender.containsKey(uuid)) {
if (tileEntity instanceof TileEntityReceiver) {
sender.put(uuid, ((TileEntityReceiver) tileEntity).getSender());
player.addChatComponentMessage(new ChatComponentTranslation("info.editor.copy.sender"));
} else {
player.addChatComponentMessage(new ChatComponentTranslation("info.editor.error"));
}
} else {
if (tileEntity instanceof TileEntityReceiver) {
((TileEntityReceiver) tileEntity).setSender(sender.get(uuid));
world.markBlockForUpdate(x, y, z);
player.addChatComponentMessage(new ChatComponentTranslation("info.editor.paste.sender"));
} else {
player.addChatComponentMessage(new ChatComponentTranslation("info.editor.error"));
}
}
}
return true;
}
return false;
}
use of net.minecraft.util.ChatComponentTranslation in project Tale-of-Kingdoms by Ivasik78.
the class GuiWorker method actionPerformed.
@Override
protected void actionPerformed(GuiButton button) {
switch(button.id) {
case 1:
this.player.addChatMessage(new ChatComponentTranslation("gui.worker.woodcut.go"));
member.defaultHeldItem = new ItemStack(Items.iron_axe, 1);
this.member.worktype = 1;
this.member.follow = true;
this.mc.displayGuiScreen(null);
break;
case 2:
this.player.addChatMessage(new ChatComponentTranslation("gui.worker.mine.go"));
member.defaultHeldItem = new ItemStack(Items.iron_pickaxe, 1);
this.member.worktype = 2;
this.member.follow = true;
this.mc.displayGuiScreen(null);
break;
case 3:
this.mc.displayGuiScreen(null);
break;
}
}
Aggregations