Search in sources :

Example 41 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project BetterWithAddons by DaedalusGame.

the class TileEntityLegendarium method insertItem.

public ItemStack insertItem(EntityPlayer player, ItemStack stack) {
    if (stack.getItem() == ModItems.artifactFrame) {
        if (cleanItemFrames() == 0) {
            populateItemFrames();
            player.sendStatusMessage(new TextComponentTranslation("tile.legendarium.frames_populated"), true);
        } else
            player.sendStatusMessage(new TextComponentTranslation("tile.legendarium.frames_cleared"), true);
        return stack;
    }
    String analysis = analyzeItem(stack);
    if (analysis != null) {
        player.sendStatusMessage(new TextComponentTranslation("tile.legendarium." + analysis), true);
        return stack;
    }
    long timeUntilNextTurnIn = lastTurnIn + InteractionBWA.LEGENDARIUM_TURN_IN_DELAY - world.getTotalWorldTime();
    if (timeUntilNextTurnIn > 0) {
        long days = timeUntilNextTurnIn / 24000;
        long hours = (timeUntilNextTurnIn % 24000) / 1000;
        player.sendStatusMessage(new TextComponentTranslation("tile.legendarium.not_now", days, hours), true);
        return stack;
    }
    ItemStack retain = queue.insertItem(0, ModItems.brokenArtifact.makeFrom(stack), false);
    if (retain.isEmpty()) {
        lastTurnIn = world.getTotalWorldTime();
        populateItemFrames();
    }
    if (queue.getSlots() >= InteractionBWA.LEGENDARIUM_MIN_QUEUE_SIZE) {
        player.sendStatusMessage(new TextComponentTranslation("tile.legendarium.ready"), true);
    }
    return retain;
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ItemStack(net.minecraft.item.ItemStack)

Example 42 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project BetterWithAddons by DaedalusGame.

the class TileEntityLegendarium method retrieveItem.

public ItemStack retrieveItem(EntityPlayer player) {
    long time = world.getTotalWorldTime();
    if (queue.getSlots() < InteractionBWA.LEGENDARIUM_MIN_QUEUE_SIZE) {
        player.sendStatusMessage(new TextComponentTranslation("tile.legendarium.not_enough_artifacts"), true);
        return ItemStack.EMPTY;
    }
    if (time - lastClick > 3 && queue.getSlots() >= InteractionBWA.LEGENDARIUM_MIN_QUEUE_SIZE) {
        lastClick = time;
        ItemStack retrieved = queue.extractItem(0, 1, false);
        populateItemFrames();
        return retrieved;
    }
    return ItemStack.EMPTY;
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ItemStack(net.minecraft.item.ItemStack)

Example 43 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project Almura by AlmuraDev.

the class CapabilityDualItemHandlerGuiHandler method getClientGuiElement.

@SideOnly(Side.CLIENT)
@Nullable
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    final BlockPos pos = new BlockPos(x, y, z);
    final Block block = world.getBlockState(pos).getBlock();
    final TileEntity te = world.getTileEntity(pos);
    if (te == null || !(te instanceof MultiSlotTileEntity)) {
        return null;
    }
    final IItemHandler teItemHandler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
    if (teItemHandler == null) {
        return null;
    }
    final IItemHandler playerItemHandler = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
    if (playerItemHandler == null) {
        return null;
    }
    return new DualItemHandlerGui(teItemHandler, playerItemHandler, new TextComponentString(block.getLocalizedName()), new TextComponentTranslation("container.inventory"));
}
Also used : MultiSlotTileEntity(com.almuradev.almura.shared.tileentity.MultiSlotTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) DualItemHandlerGui(com.almuradev.almura.shared.network.handler.DualItemHandlerGui) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) IItemHandler(net.minecraftforge.items.IItemHandler) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos) MultiSlotTileEntity(com.almuradev.almura.shared.tileentity.MultiSlotTileEntity) TextComponentString(net.minecraft.util.text.TextComponentString) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nullable(javax.annotation.Nullable)

Example 44 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project GregTech by GregTechCE.

the class VacuumFreezerInfo method generateBlockTooltips.

@Override
protected void generateBlockTooltips() {
    super.generateBlockTooltips();
    ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.preview.limit", 14).setStyle(new Style().setColor(TextFormatting.AQUA));
    addBlockTooltip(MetaBlocks.METAL_CASING.getItemVariant(MetalCasingType.ALUMINIUM_FROSTPROOF), tooltip);
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ITextComponent(net.minecraft.util.text.ITextComponent) Style(net.minecraft.util.text.Style)

Example 45 with TextComponentTranslation

use of net.minecraft.util.text.TextComponentTranslation in project GregTech by GregTechCE.

the class CrackerUnitInfo method generateBlockTooltips.

@Override
protected void generateBlockTooltips() {
    super.generateBlockTooltips();
    ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.preview.limit", 20).setStyle(new Style().setColor(TextFormatting.AQUA));
    addBlockTooltip(MetaBlocks.METAL_CASING.getItemVariant(BlockMetalCasing.MetalCasingType.STAINLESS_CLEAN), tooltip);
}
Also used : TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) ITextComponent(net.minecraft.util.text.ITextComponent) Style(net.minecraft.util.text.Style)

Aggregations

TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)502 ItemStack (net.minecraft.item.ItemStack)134 ITextComponent (net.minecraft.util.text.ITextComponent)82 EntityPlayer (net.minecraft.entity.player.EntityPlayer)72 BlockPos (net.minecraft.util.math.BlockPos)70 TextComponentString (net.minecraft.util.text.TextComponentString)66 Style (net.minecraft.util.text.Style)60 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)58 TileEntity (net.minecraft.tileentity.TileEntity)45 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)36 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)33 ArrayList (java.util.ArrayList)32 World (net.minecraft.world.World)30 IBlockState (net.minecraft.block.state.IBlockState)28 EnumFacing (net.minecraft.util.EnumFacing)26 CommandException (net.minecraft.command.CommandException)25 Block (net.minecraft.block.Block)20 Nonnull (javax.annotation.Nonnull)19 WrongUsageException (net.minecraft.command.WrongUsageException)19 EnumActionResult (net.minecraft.util.EnumActionResult)19