Search in sources :

Example 31 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project ImmersiveEngineering by BluSunrize.

the class TileEntityFloodlight method hammerUseSide.

@Override
public boolean hammerUseSide(EnumFacing side, EntityPlayer player, float hitX, float hitY, float hitZ) {
    if (player.isSneaking() && side != this.side) {
        boolean base = this.side == EnumFacing.DOWN ? hitY >= .8125 : this.side == EnumFacing.UP ? hitY <= .1875 : this.side == EnumFacing.NORTH ? hitZ >= .8125 : this.side == EnumFacing.UP ? hitZ <= .1875 : this.side == EnumFacing.WEST ? hitX >= .8125 : hitX <= .1875;
        if (base) {
            redstoneControlInverted = !redstoneControlInverted;
            ChatUtils.sendServerNoSpamMessages(player, new TextComponentTranslation(Lib.CHAT_INFO + "rsControl." + (redstoneControlInverted ? "invertedOn" : "invertedOff")));
            markDirty();
            this.markContainingBlockForUpdate(null);
            return true;
        }
    }
    if (side.getAxis() == this.side.getAxis())
        turnY(player.isSneaking(), false);
    else
        turnX(player.isSneaking(), false);
    return true;
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation)

Example 32 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project ConvenientAdditions by Necr0.

the class LevelUp method lvlUp.

public static void lvlUp(EntityPlayer p, ItemStack s) {
    ModItems.itemAdventurersPickaxe.setToolProperty(s, "lvl", (int) ModItems.itemAdventurersPickaxe.getToolProperty(s, "lvl") + 1);
    ModItems.itemAdventurersPickaxe.setToolProperty(s, "xp", 0);
    int lvl = (int) ModItems.itemAdventurersPickaxe.getToolProperty(s, "lvl");
    ModItems.itemAdventurersPickaxe.setToolProperty(s, "durability", (int) ModItems.itemAdventurersPickaxe.getToolProperty(s, "durability") + (lvl * 3));
    s.setItemDamage(s.getItemDamage() + (lvl * 2));
    applyRandomUpgrade(s);
    boolean msg = p != null && !p.world.isRemote;
    switch(lvl) {
        case 5:
            ModItems.itemAdventurersPickaxe.setToolProperty(s, "mining_level", 1);
            s.setItemDamage(Math.min(s.getItemDamage() - ((int) ModItems.itemAdventurersPickaxe.getToolProperty(s, "durability") / 2), 0));
            if (msg) {
                p.sendMessage(new TextComponentTranslation("message." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.adventurersPickaxe + "LevelUpMiningLevel", new TextComponentTranslation(ModConstants.Items.AdvPick.unlocalizedMiningLevelNames[1])));
            }
            break;
        case 10:
            ModItems.itemAdventurersPickaxe.setToolProperty(s, "magnetic", true);
            if (msg) {
                p.sendMessage(new TextComponentTranslation("message." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.adventurersPickaxe + "LevelUpMagnetic"));
            }
            break;
        case 15:
            ModItems.itemAdventurersPickaxe.setToolProperty(s, "mining_level", 2);
            s.setItemDamage(Math.min(s.getItemDamage() - ((int) ModItems.itemAdventurersPickaxe.getToolProperty(s, "durability") / 5), 0));
            if (msg) {
                p.sendMessage(new TextComponentTranslation("message." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.adventurersPickaxe + "LevelUpMiningLevel", new TextComponentTranslation(ModConstants.Items.AdvPick.unlocalizedMiningLevelNames[2])));
            }
            break;
        case 20:
            ModItems.itemAdventurersPickaxe.setToolProperty(s, "mining_luck", 1);
            if (msg) {
                p.sendMessage(new TextComponentTranslation("message." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.adventurersPickaxe + "LevelUpLuck", 1));
            }
            break;
        case 25:
            ModItems.itemAdventurersPickaxe.setToolProperty(s, "mining_level", 3);
            s.setItemDamage(Math.min(s.getItemDamage() - ((int) ModItems.itemAdventurersPickaxe.getToolProperty(s, "durability") / 5), 0));
            if (msg) {
                p.sendMessage(new TextComponentTranslation("message." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.adventurersPickaxe + "LevelUpMiningLevel", new TextComponentTranslation(ModConstants.Items.AdvPick.unlocalizedMiningLevelNames[3])));
            }
            break;
        case 30:
            ModItems.itemAdventurersPickaxe.setToolProperty(s, "soulbound", true);
            if (msg) {
                p.sendMessage(new TextComponentTranslation("message." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.adventurersPickaxe + "LevelUpSoulbound"));
            }
            break;
        case 35:
            ModItems.itemAdventurersPickaxe.setToolProperty(s, "mining_luck", 2);
            if (msg) {
                p.sendMessage(new TextComponentTranslation("message." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.adventurersPickaxe + "LevelUpLuck", 2));
            }
            break;
        case 45:
            ModItems.itemAdventurersPickaxe.setToolProperty(s, "mining_luck", 3);
            if (msg) {
                p.sendMessage(new TextComponentTranslation("message." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.adventurersPickaxe + "LevelUpLuck", 3));
            }
            break;
        case 55:
            ModItems.itemAdventurersPickaxe.setToolProperty(s, "mining_luck", 4);
            if (msg) {
                p.sendMessage(new TextComponentTranslation("message." + ModConstants.Mod.MODID + ":" + ModConstants.ItemNames.adventurersPickaxe + "LevelUpLuck", 4));
            }
            break;
    }
    NBTTagCompound nbt = s.getTagCompound();
    NBTTagCompound props = (NBTTagCompound) nbt.getTag("TOOL_PROPERTIES");
    props.setTag("STATISTICS", new NBTTagCompound());
    p.getEntityWorld().playSound(null, p.posX, p.posY, p.posZ, SoundEvents.ENTITY_PLAYER_LEVELUP, SoundCategory.PLAYERS, 1.0F, 1.0F);
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 33 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project SecurityCraft by Geforce132.

the class BlockCageTrap method onEntityIntersected.

@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
    if (!world.isRemote) {
        if (entity instanceof EntityPlayer && !BlockUtils.getBlockPropertyAsBoolean(world, pos, DEACTIVATED)) {
            if (((IOwnable) world.getTileEntity(pos)).getOwner().isOwner((EntityPlayer) entity))
                return;
            BlockUtils.setBlockProperty(world, pos, DEACTIVATED, true);
            BlockUtils.setBlock(world, pos.up(4), mod_SecurityCraft.unbreakableIronBars);
            BlockUtils.setBlock(world, pos.getX() + 1, pos.getY() + 4, pos.getZ(), mod_SecurityCraft.unbreakableIronBars);
            BlockUtils.setBlock(world, pos.getX() - 1, pos.getY() + 4, pos.getZ(), mod_SecurityCraft.unbreakableIronBars);
            BlockUtils.setBlock(world, pos.getX(), pos.getY() + 4, pos.getZ() + 1, mod_SecurityCraft.unbreakableIronBars);
            BlockUtils.setBlock(world, pos.getX(), pos.getY() + 4, pos.getZ() - 1, mod_SecurityCraft.unbreakableIronBars);
            BlockUtils.setBlockInBox(world, pos.getX(), pos.getY(), pos.getZ(), mod_SecurityCraft.unbreakableIronBars);
            entity.playSound(SoundEvent.REGISTRY.getObject(new ResourceLocation("random.anvil_use")), 3.0F, 1.0F);
            world.getMinecraftServer().addChatMessage(new TextComponentTranslation("[" + TextFormatting.BLACK + I18n.translateToLocal("tile.cageTrap.name") + TextFormatting.RESET + "] " + I18n.translateToLocal("messages.cageTrap.captured").replace("#player", ((EntityPlayer) entity).getName()).replace("#location", Utils.getFormattedCoordinates(pos))));
        }
    }
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ResourceLocation(net.minecraft.util.ResourceLocation) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 34 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project RecurrentComplex by Ivorforce.

the class RCForgeEventHandler method onCommand.

@SubscribeEvent
public void onCommand(CommandEvent event) {
    if (!RCConfig.canUseCommand(event.getCommand().getName(), event.getSender())) {
        event.setCanceled(true);
        // From CommandHandler.executeCommand
        TextComponentTranslation TextComponent = new TextComponentTranslation("commands.generic.permission");
        TextComponent.getStyle().setColor(TextFormatting.RED);
        event.getSender().sendMessage(TextComponent);
    }
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 35 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project Realistic-Terrain-Generation by Team-RTG.

the class WorldTypeMessageGUI method drawScreen.

@Override
public void drawScreen(int x, int y, float renderPartialTicks) {
    TextComponentTranslation rtgStartup1 = new TextComponentTranslation("warning.rtgStartup1");
    TextComponentTranslation rtgStartup2 = new TextComponentTranslation("warning.rtgStartup2");
    TextComponentTranslation rtgStartup3 = new TextComponentTranslation("warning.rtgStartup3");
    TextComponentTranslation rtgStartup4 = new TextComponentTranslation("warning.rtgStartup4");
    TextComponentTranslation rtgStartup5 = new TextComponentTranslation("warning.rtgStartup5");
    TextComponentTranslation rtgStartup6 = new TextComponentTranslation("warning.rtgStartup6");
    this.drawDefaultBackground();
    this.drawCenteredString(this.fontRendererObj, "" + WHITE + rtgStartup1.getFormattedText(), this.width / 2, 82, 0xFFFFFF);
    this.drawCenteredString(this.fontRendererObj, "" + WHITE + rtgStartup2.getFormattedText(), this.width / 2, 94, 0xFFFFFF);
    this.drawCenteredString(this.fontRendererObj, "" + WHITE + rtgStartup3.getFormattedText(), this.width / 2, 106, 0xFFFFFF);
    this.drawCenteredString(this.fontRendererObj, "" + WHITE + rtgStartup4.getFormattedText(), this.width / 2, 132, 0xFFFFFF);
    this.drawCenteredString(this.fontRendererObj, "" + WHITE + rtgStartup5.getFormattedText(), this.width / 2, 144, 0xFFFFFF);
    this.drawCenteredString(this.fontRendererObj, "" + DARK_RED + rtgStartup6.getFormattedText(), this.width / 2, 168, 0xFFFFFF);
    GL11.glEnable(GL11.GL_BLEND);
    this.mc.getTextureManager().bindTexture(rtgLogoTexture);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.drawTexturedModalRect(this.width / 2 - 168 / 2, 0, 0, 0, 168, 80);
    GL11.glDisable(GL11.GL_BLEND);
    super.drawScreen(x, y, renderPartialTicks);
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation)

Aggregations

TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)35 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 TileEntity (net.minecraft.tileentity.TileEntity)5 TextComponentString (net.minecraft.util.text.TextComponentString)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 ActionResult (net.minecraft.util.ActionResult)4 EnumActionResult (net.minecraft.util.EnumActionResult)4 BlockPos (net.minecraft.util.math.BlockPos)4 TargetingInfo (blusunrize.immersiveengineering.api.TargetingInfo)2 IImmersiveConnectable (blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable)2 ItemStack (net.minecraft.item.ItemStack)2 ITextComponent (net.minecraft.util.text.ITextComponent)2 DimensionChunkCoords (blusunrize.immersiveengineering.api.DimensionChunkCoords)1 IMultiblock (blusunrize.immersiveengineering.api.MultiblockHandler.IMultiblock)1 IFluxProvider (blusunrize.immersiveengineering.api.energy.immersiveflux.IFluxProvider)1 IFluxReceiver (blusunrize.immersiveengineering.api.energy.immersiveflux.IFluxReceiver)1 AbstractConnection (blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.AbstractConnection)1 Connection (blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection)1 WireType (blusunrize.immersiveengineering.api.energy.wires.WireType)1 MineralMix (blusunrize.immersiveengineering.api.tool.ExcavatorHandler.MineralMix)1