Search in sources :

Example 21 with TextComponentTranslation

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

the class TileEntityBreakerSwitch method hammerUseSide.

@Override
public boolean hammerUseSide(EnumFacing side, EntityPlayer player, float hitX, float hitY, float hitZ) {
    if (player.isSneaking()) {
        inverted = !inverted;
        ChatUtils.sendServerNoSpamMessages(player, new TextComponentTranslation(Lib.CHAT_INFO + "rsSignal." + (inverted ? "invertedOn" : "invertedOff")));
        if (this instanceof TileEntityBreakerSwitch && wires > 1)
            ImmersiveNetHandler.INSTANCE.resetCachedIndirectConnections();
        notifyNeighbours();
    } else {
        rotation = (rotation + 3) % 4;
        onConnectionChange();
    }
    return true;
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation)

Example 22 with TextComponentTranslation

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

the class IEAchievements method init.

public static void init() {
    openManual = new AchievementIE("openManual", 0, 1, new ItemStack(IEContent.itemTool, 1, 3), null);
    craftHammer = new AchievementIE("craftHammer", 3, 2, IEContent.itemTool, openManual).setNormalCrafting();
    connectWire = new AchievementIE("connectWire", 0, -1, IEContent.itemWireCoil, openManual);
    blastfurnace = new AchievementIE("blastfurnace", 2, 1, new ItemStack(IEContent.blockStoneDevice, 1, BlockTypes_StoneDevices.BLAST_FURNACE.getMeta()), craftHammer);
    makeSteel = new AchievementIE("makeSteel", 2, -1, new ItemStack(IEContent.itemMetal, 1, 8), blastfurnace);
    placeConveyor = new AchievementIE("placeConveyor", 1, 3, ConveyorHandler.getConveyorStack(ImmersiveEngineering.MODID + ":conveyor"), openManual).setPlacement(new ItemStack(IEContent.blockConveyor));
    placeWindmill = new AchievementIE("placeWindmill", -1, 3, new ItemStack(IEContent.blockWoodenDevice1, 1, BlockTypes_WoodenDevice1.WINDMILL.getMeta()), openManual).setPlacement(new ItemStack(IEContent.blockWoodenDevice1, 1, BlockTypes_WoodenDevice1.WINDMILL.getMeta()), new ItemStack(IEContent.blockWoodenDevice1, 1, BlockTypes_WoodenDevice1.WINDMILL_ADVANCED.getMeta()));
    craftHeater = new AchievementIE("craftHeater", -2, 4, new ItemStack(IEContent.blockMetalDevice1, 1, BlockTypes_MetalDevice1.FURNACE_HEATER.getMeta()), openManual).setNormalCrafting();
    craftPump = new AchievementIE("craftPump", 2, 4, new ItemStack(IEContent.blockMetalDevice0, 1, BlockTypes_MetalDevice0.FLUID_PUMP.getMeta()), openManual).setNormalCrafting();
    placeFloodlight = new AchievementIE("placeFloodlight", -1, 5, new ItemStack(IEContent.blockMetalDevice1, 1, BlockTypes_MetalDevice1.FLOODLIGHT.getMeta()), openManual).setPlacement();
    mbImprovedBlastFurnace = new AchievementIE("mbImprovedBlastFurnace", 6, -3, new ItemStack(IEContent.blockStoneDevice, 1, BlockTypes_StoneDevices.BLAST_FURNACE_ADVANCED.getMeta()), makeSteel).setSpecial();
    mbMetalPress = new AchievementIE("mbMetalPress", 6, -2, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.METAL_PRESS.getMeta()), makeSteel).setSpecial();
    mbCrusher = new AchievementIE("mbCrusher", 6, -1, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.CRUSHER.getMeta()), makeSteel).setSpecial();
    mbSilo = new AchievementIE("mbSilo", 7, -2, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.SILO.getMeta()), craftHammer).setSpecial();
    mbDieselGen = new AchievementIE("mbDieselGen", 6, 0, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.DIESEL_GENERATOR.getMeta()), craftHammer).setSpecial();
    mbExcavator = new AchievementIE("mbExcavator", 6, 1, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.EXCAVATOR.getMeta()), craftHammer).setSpecial();
    mbArcFurnace = new AchievementIE("mbArcFurnace", 6, 2, new ItemStack(IEContent.blockMetalMultiblock, 1, BlockTypes_MetalMultiblock.ARC_FURNACE.getMeta()), craftHammer).setSpecial();
    craftWorkbench = new AchievementIE("craftWorkbench", 2, -3, new ItemStack(IEContent.blockWoodenDevice0, 1, BlockTypes_WoodenDevice0.WORKBENCH.getMeta()), makeSteel).setNormalCrafting();
    craftRevolver = new AchievementIE("craftRevolver", 3, -6, IEContent.itemRevolver, craftWorkbench).setNormalCrafting();
    ItemStack[] upgrades = new ItemStack[20];
    upgrades[18] = new ItemStack(IEContent.itemToolUpgrades, 1, 5);
    upgrades[19] = new ItemStack(IEContent.itemToolUpgrades, 1, 6);
    ItemStack revolver = new ItemStack(IEContent.itemRevolver);
    ((ItemRevolver) IEContent.itemRevolver).setContainedItems(revolver, upgrades);
    ((ItemRevolver) IEContent.itemRevolver).recalculateUpgrades(revolver);
    upgradeRevolver = new AchievementIE("upgradeRevolver", 4, -6, revolver, craftRevolver);
    if (!BulletHandler.homingCartridges.isEmpty())
        craftWolfPack = new AchievementIE("craftWolfPack", 4, -7, BulletHandler.getBulletStack("wolfpack"), craftRevolver).setCheckNBT(true).setBlueprintCrafting().setSpecial();
    ItemStack drill = new ItemStack(IEContent.itemDrill);
    ((ItemDrill) IEContent.itemDrill).setHead(drill, new ItemStack(IEContent.itemDrillhead));
    craftDrill = new AchievementIE("craftDrill", 1, -6, drill, craftWorkbench).setNormalCrafting();
    upgrades = new ItemStack[4];
    upgrades[0] = new ItemStack(IEContent.itemDrillhead);
    upgrades[1] = new ItemStack(IEContent.itemToolUpgrades, 1, 0);
    upgrades[2] = new ItemStack(IEContent.itemToolUpgrades, 1, 1);
    upgrades[3] = new ItemStack(IEContent.itemToolUpgrades, 3, 2);
    ItemStack drill2 = drill.copy();
    ((ItemDrill) IEContent.itemDrill).setContainedItems(drill2, upgrades);
    ((ItemDrill) IEContent.itemDrill).recalculateUpgrades(drill2);
    upgradeDrill = new AchievementIE("upgradeDrill", 0, -6, drill2, craftDrill);
    craftSkyhook = new AchievementIE("craftSkyhook", 1, -5, IEContent.itemSkyhook, craftWorkbench).setNormalCrafting();
    ItemStack hook = new ItemStack(IEContent.itemSkyhook);
    hook.addEnchantment(Enchantments.UNBREAKING, 1);
    //skyhookPro = new AchievementIE("skyhookPro", 0, -5, hook, craftSkyhook);
    craftChemthrower = new AchievementIE("craftChemthrower", 3, -5, IEContent.itemChemthrower, craftWorkbench).setNormalCrafting();
    craftRailgun = new AchievementIE("craftRailgun", 1, -7, IEContent.itemRailgun, craftWorkbench).setNormalCrafting();
    secret_birthdayParty = new AchievementIE("secret_birthdayParty", -4, -1, new ItemStack(IEContent.itemFakeIcons, 1, 0), null).setSpecial();
    secret_luckOfTheDraw = new AchievementIE("secret_luckOfTheDraw", -4, 1, new ItemStack(IEContent.itemFakeIcons, 1, 1), null).setSpecial();
    ieAchievementPage = new AchievementPage(ImmersiveEngineering.MODNAME, AchievementIE.achievements.toArray(new Achievement[AchievementIE.achievements.size()]));
    AchievementPage.registerAchievementPage(ieAchievementPage);
    statDistanceSkyhook = new StatBase("stat.skyhookOneCm", new TextComponentTranslation("stat.skyhookOneCm", new Object[0]), StatBase.distanceStatType) {

        @Override
        public StatBase registerStat() {
            super.registerStat();
            StatList.BASIC_STATS.add(12, this);
            return this;
        }
    }.initIndependentStat().registerStat();
}
Also used : ItemRevolver(blusunrize.immersiveengineering.common.items.ItemRevolver) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) AchievementPage(net.minecraftforge.common.AchievementPage) StatBase(net.minecraft.stats.StatBase) ItemStack(net.minecraft.item.ItemStack) ItemDrill(blusunrize.immersiveengineering.common.items.ItemDrill)

Example 23 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project Pearcel-Mod by MiningMark48.

the class ItemMatterFabricator method onItemRightClick.

@Override
public ActionResult onItemRightClick(ItemStack item, World world, EntityPlayer player, EnumHand hand) {
    if (player.isSneaking()) {
        if (!item.hasTagCompound()) {
            item.setTagCompound(new NBTTagCompound());
            item.getTagCompound().setInteger("mode", 1);
        } else {
            if (item.getTagCompound().getInteger("mode") == 1) {
                item.getTagCompound().setInteger("mode", 2);
                if (!world.isRemote) {
                    player.sendMessage(new TextComponentTranslation(TextFormatting.GOLD + (Translate.toLocal("chat.item.mf.modeChange"))));
                }
            } else {
                item.getTagCompound().setInteger("mode", 1);
                if (!world.isRemote) {
                    player.sendMessage(new TextComponentTranslation(TextFormatting.GOLD + (Translate.toLocal("chat.item.mf.modeChange"))));
                }
            }
        }
        return new ActionResult(EnumActionResult.PASS, item);
    } else {
        return new ActionResult(EnumActionResult.PASS, item);
    }
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ActionResult(net.minecraft.util.ActionResult) EnumActionResult(net.minecraft.util.EnumActionResult) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 24 with TextComponentTranslation

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

the class TileEntityStripCurtain method hammerUseSide.

@Override
public boolean hammerUseSide(EnumFacing side, EntityPlayer player, float hitX, float hitY, float hitZ) {
    strongSignal = !strongSignal;
    ChatUtils.sendServerNoSpamMessages(player, new TextComponentTranslation(Lib.CHAT_INFO + "rsControl.strongSignal." + strongSignal));
    return true;
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation)

Example 25 with TextComponentTranslation

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

the class TileEntityCoresample method interact.

@Override
public boolean interact(EnumFacing side, EntityPlayer player, EnumHand hand, ItemStack heldItem, float hitX, float hitY, float hitZ) {
    if (player.isSneaking()) {
        if (!getWorld().isRemote) {
            EntityItem entityitem = new EntityItem(getWorld(), getPos().getX() + .5, getPos().getY() + .5, getPos().getZ() + .5, getTileDrop(player, getWorld().getBlockState(getPos())));
            entityitem.setDefaultPickupDelay();
            getWorld().setBlockToAir(getPos());
            getWorld().spawnEntityInWorld(entityitem);
        }
        return true;
    } else if (heldItem != null && heldItem.getItem() == Items.FILLED_MAP && ItemNBTHelper.hasKey(coresample, "coords")) {
        if (!getWorld().isRemote) {
            MapData mapData = ((ItemMap) heldItem.getItem()).getMapData(heldItem, player.getEntityWorld());
            if (mapData != null) {
                int[] coords = ItemNBTHelper.getIntArray(coresample, "coords");
                String ident = "ie:coresample_" + coords[0] + ";" + coords[1] + ";" + coords[2];
                if (mapData.mapDecorations.containsKey(ident)) {
                    mapData.mapDecorations.remove(ident);
                    return true;
                }
                double sampleX = coords[1] * 16 + 8.5;
                double sampleZ = coords[2] * 16 + 8.5;
                int mapScale = 1 << mapData.scale;
                float distX = (float) (sampleX - mapData.xCenter) / (float) mapScale;
                float distZ = (float) (sampleZ - mapData.zCenter) / (float) mapScale;
                byte mapX = (byte) ((int) ((double) (distX * 2.0F) + 0.5D));
                byte mapZ = (byte) ((int) ((double) (distZ * 2.0F) + 0.5D));
                byte b2 = (byte) 8;
                if (distX >= -63 && distX <= 63 && distZ >= -63 && distZ <= 63)
                    mapData.mapDecorations.put(ident, new Vec4b((byte) 5, mapX, mapZ, b2));
                else
                    player.addChatMessage(new TextComponentTranslation(Lib.CHAT_INFO + "coresample.mapFail"));
            }
        }
        return true;
    }
    return false;
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) MapData(net.minecraft.world.storage.MapData) Vec4b(net.minecraft.util.math.Vec4b) TextComponentString(net.minecraft.util.text.TextComponentString) EntityItem(net.minecraft.entity.item.EntityItem)

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