Search in sources :

Example 91 with ChatComponentText

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;
    }
}
Also used : ItemStack(net.minecraft.item.ItemStack) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 92 with ChatComponentText

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;
}
Also used : ItemKeystone(am2.items.ItemKeystone) ItemStack(net.minecraft.item.ItemStack) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 93 with ChatComponentText

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;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) TileEntityParticleEmitter(am2.blocks.tileentities.TileEntityParticleEmitter) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 94 with ChatComponentText

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))));
        }
    }
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) IOwnable(net.geforcemods.securitycraft.api.IOwnable) ChatComponentText(net.minecraft.util.ChatComponentText)

Example 95 with ChatComponentText

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);
    }
}
Also used : Selection(com.builtbroken.mc.lib.world.edit.Selection) ChatComponentText(net.minecraft.util.ChatComponentText)

Aggregations

ChatComponentText (net.minecraft.util.ChatComponentText)108 EntityPlayer (net.minecraft.entity.player.EntityPlayer)19 ItemStack (net.minecraft.item.ItemStack)16 TileEntity (net.minecraft.tileentity.TileEntity)9 Entity (net.minecraft.entity.Entity)8 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)7 ArrayList (java.util.ArrayList)7 Block (net.minecraft.block.Block)6 AMVector3 (am2.api.math.AMVector3)4 AccessGroup (com.builtbroken.mc.framework.access.AccessGroup)4 Pos (com.builtbroken.mc.imp.transform.vector.Pos)4 OpenChatGui (logisticspipes.network.packets.gui.OpenChatGui)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 ChatStyle (net.minecraft.util.ChatStyle)4 IPowerNode (am2.api.power.IPowerNode)3 IItemActivationListener (com.builtbroken.mc.api.items.listeners.IItemActivationListener)3 IItemEventListener (com.builtbroken.mc.api.items.listeners.IItemEventListener)3 AbstractCommand (com.builtbroken.mc.core.commands.prefab.AbstractCommand)3 ItemListenerIterator (com.builtbroken.mc.prefab.items.listeners.ItemListenerIterator)3 EntityLivingBase (net.minecraft.entity.EntityLivingBase)3