use of net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.
the class KeystoneUtilities method HandleKeystoneRecovery.
public static boolean HandleKeystoneRecovery(EntityPlayer player, IKeystoneLockable lock) {
if (ExtendedProperties.For(player).isRecoveringKeystone) {
if (KeystoneUtilities.instance.getKeyFromRunes(lock.getRunesInKey()) != 0) {
String combo = "";
for (ItemStack rune : lock.getRunesInKey()) {
if (rune == null)
combo += "empty ";
else
combo += rune.getDisplayName() + " ";
}
player.addChatMessage(new ChatComponentText(combo));
} else {
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("am2.tooltip.noKeyPresent")));
}
ExtendedProperties.For(player).isRecoveringKeystone = false;
return true;
} else {
return false;
}
}
use of net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.
the class KeystoneUtilities method canPlayerAccess.
@Override
public boolean canPlayerAccess(IKeystoneLockable inventory, EntityPlayer player, KeystoneAccessType accessMode) {
ItemStack[] runes = inventory.getRunesInKey();
long key = getKeyFromRunes(runes);
if (//no key combo set? No lock! Access granted!
key == 0)
return true;
if (inventory.keystoneMustBeHeld()) {
if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ItemsCommonProxy.keystone) {
return ((ItemKeystone) player.getCurrentEquippedItem().getItem()).getKey(player.getCurrentEquippedItem()) == key;
}
} else if (inventory.keystoneMustBeInActionBar()) {
for (int i = 0; i < 9; ++i) {
ItemStack stack = player.inventory.getStackInSlot(i);
if (stack == null || stack.getItem() != ItemsCommonProxy.keystone)
continue;
if (((ItemKeystone) stack.getItem()).getKey(stack) == key) {
return true;
}
}
} else {
for (int i = 0; i < player.inventory.mainInventory.length; ++i) {
ItemStack stack = player.inventory.getStackInSlot(i);
if (stack == null || stack.getItem() != ItemsCommonProxy.keystone)
continue;
if (((ItemKeystone) stack.getItem()).getKey(stack) == key) {
return true;
}
}
}
if (accessMode == KeystoneAccessType.USE) {
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("am2.tooltip.wrongKeystoneUse")));
} else if (accessMode == KeystoneAccessType.BREAK) {
player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("am2.tooltip.wrongKeystoneBreak")));
}
return false;
}
use of net.minecraft.util.ChatComponentText in project ArsMagica2 by Mithion.
the class BlockParticleEmitter method onBlockActivated.
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (par1World.isRemote) {
TileEntity te = par1World.getTileEntity(par2, par3, par4);
if (te != null && te instanceof TileEntityParticleEmitter) {
if (par5EntityPlayer.inventory.getCurrentItem() != null && par5EntityPlayer.inventory.getCurrentItem().getItem() == ItemsCommonProxy.crystalWrench) {
if (ItemCrystalWrench.getMode(par5EntityPlayer.inventory.getCurrentItem()) == 0) {
AMCore.proxy.openParticleBlockGUI(par1World, par5EntityPlayer, (TileEntityParticleEmitter) te);
} else {
if (AMCore.proxy.cwCopyLoc == null) {
par5EntityPlayer.addChatMessage(new ChatComponentText("Settings Copied."));
AMCore.proxy.cwCopyLoc = new NBTTagCompound();
((TileEntityParticleEmitter) te).writeSettingsToNBT(AMCore.proxy.cwCopyLoc);
} else {
par5EntityPlayer.addChatMessage(new ChatComponentText("Settings Applied."));
((TileEntityParticleEmitter) te).readSettingsFromNBT(AMCore.proxy.cwCopyLoc);
((TileEntityParticleEmitter) te).syncWithServer();
AMCore.proxy.cwCopyLoc = null;
}
}
return true;
} else {
AMCore.proxy.openParticleBlockGUI(par1World, par5EntityPlayer, (TileEntityParticleEmitter) te);
return true;
}
}
}
return false;
}
use of net.minecraft.util.ChatComponentText 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) {
IOwnable originalTrap = (IOwnable) par1World.getTileEntity(par2, par3, par4);
if (originalTrap.getOwner().isOwner((EntityPlayer) par5Entity))
return;
par1World.setBlock(par2, par3, par4, mod_SecurityCraft.deactivatedCageTrap);
par1World.setBlock(par2, par3 + 4, par4, mod_SecurityCraft.unbreakableIronBars);
par1World.setBlock(par2 + 1, par3 + 4, par4, mod_SecurityCraft.unbreakableIronBars);
par1World.setBlock(par2 - 1, par3 + 4, par4, mod_SecurityCraft.unbreakableIronBars);
par1World.setBlock(par2, par3 + 4, par4 + 1, mod_SecurityCraft.unbreakableIronBars);
par1World.setBlock(par2, par3 + 4, par4 - 1, mod_SecurityCraft.unbreakableIronBars);
BlockUtils.setBlockInBox(par1World, par2, par3, par4, mod_SecurityCraft.unbreakableIronBars);
setTileEntities(par1World, par2, par3, par4, originalTrap.getOwner().getUUID(), originalTrap.getOwner().getName());
par1World.playSoundAtEntity(par5Entity, "random.anvil_use", 3.0F, 1.0F);
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(new ChatComponentText("[" + EnumChatFormatting.BLACK + StatCollector.translateToLocal("tile.cageTrap.name") + EnumChatFormatting.RESET + "] " + StatCollector.translateToLocal("messages.cageTrap.captured").replace("#player", ((EntityPlayer) par5Entity).getCommandSenderName()).replace("#location", Utils.getFormattedCoordinates(par2, par3, par4))));
}
}
}
use of net.minecraft.util.ChatComponentText in project Engine by VoltzEngine-Project.
the class ItemSelectionWand method handelSelection.
public static void handelSelection(EntityPlayer player, Location location) {
if (!location.world().isRemote) {
Selection select = SelectionHandler.getSelection(player);
if (player.isSneaking()) {
select.setPointOne(location.toPos());
if (Engine.runningAsDev)
player.addChatComponentMessage(new ChatComponentText(("Point One: " + select)));
} else {
select.setPointTwo(location.toPos());
if (Engine.runningAsDev)
player.addChatComponentMessage(new ChatComponentText(("Point Two: " + select)));
}
SelectionHandler.setSelection(player, select);
}
}
Aggregations