Search in sources :

Example 21 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project ImmersiveEngineering by BluSunrize.

the class ChatUtils method sendClientNoSpamMessages.

//Credit goes to WayOfFlowingTime
@SideOnly(Side.CLIENT)
public static void sendClientNoSpamMessages(ITextComponent[] messages) {
    GuiNewChat chat = Minecraft.getMinecraft().ingameGUI.getChatGUI();
    for (int i = DELETION_ID + messages.length - 1; i <= lastAdded; i++) chat.deleteChatLine(i);
    for (int i = 0; i < messages.length; i++) chat.printChatMessageWithOptionalDeletion(messages[i], DELETION_ID + i);
    lastAdded = DELETION_ID + messages.length - 1;
}
Also used : GuiNewChat(net.minecraft.client.gui.GuiNewChat) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 22 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project ImmersiveEngineering by BluSunrize.

the class ItemJerrycan method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean adv) {
    FluidStack fs = FluidUtil.getFluidContained(stack);
    if (fs != null) {
        TextFormatting rarity = fs.getFluid().getRarity() == EnumRarity.COMMON ? TextFormatting.GRAY : fs.getFluid().getRarity().rarityColor;
        list.add(rarity + fs.getLocalizedName() + TextFormatting.GRAY + ": " + fs.amount + "/" + 10000 + "mB");
    } else
        list.add(I18n.format(Lib.DESC_FLAVOUR + "drill.empty"));
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) TextFormatting(net.minecraft.util.text.TextFormatting) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 23 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project ImmersiveEngineering by BluSunrize.

the class ItemCoresample method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean adv) {
    if (ItemNBTHelper.hasKey(stack, "coords")) {
        if (ItemNBTHelper.hasKey(stack, "mineral")) {
            String mineral = ItemNBTHelper.getString(stack, "mineral");
            String unloc = Lib.DESC_INFO + "mineral." + mineral;
            String loc = I18n.format(unloc);
            list.add(I18n.format(Lib.CHAT_INFO + "coresample.mineral", (unloc.equals(loc) ? mineral : loc)));
        } else
            list.add(I18n.format(Lib.CHAT_INFO + "coresample.noMineral"));
        int[] coords = ItemNBTHelper.getIntArray(stack, "coords");
        World world = DimensionManager.getWorld(coords[0]);
        String s0 = (coords[1] * 16) + ", " + (coords[2] * 16);
        String s1 = (coords[1] * 16 + 16) + ", " + (coords[2] * 16 + 16);
        String s2;
        if (world != null && world.provider != null) {
            String name = world.provider.getDimensionType().getName();
            if (name.toLowerCase(Locale.ENGLISH).startsWith("the "))
                name = name.substring(4);
            s2 = name;
        } else
            s2 = "Dimension " + coords[0];
        list.add(s2);
        list.add(I18n.format(Lib.CHAT_INFO + "coresample.pos", s0, s1, ""));
        if (ItemNBTHelper.hasKey(stack, "infinite"))
            list.add(I18n.format(Lib.CHAT_INFO + "coresample.infinite"));
        else if (ItemNBTHelper.hasKey(stack, "depletion"))
            list.add(I18n.format(Lib.CHAT_INFO + "coresample.yield", ExcavatorHandler.mineralVeinCapacity - ItemNBTHelper.getInt(stack, "depletion")));
        if (ItemNBTHelper.hasKey(stack, "timestamp") && world != null) {
            long timestamp = ItemNBTHelper.getLong(stack, "timestamp");
            long dist = world.getTotalWorldTime() - timestamp;
            if (dist < 0)
                list.add("Somehow this sample is dated in the future...are you a time traveller?!");
            else
                list.add(I18n.format(Lib.CHAT_INFO + "coresample.timestamp", ClientUtils.fomatTimestamp(dist, ClientUtils.TimestampFormat.DHM)));
        } else
            list.add(I18n.format(Lib.CHAT_INFO + "coresample.noTimestamp"));
    }
}
Also used : World(net.minecraft.world.World) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 24 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project ImmersiveEngineering by BluSunrize.

the class ItemDrill method applyTransformations.

@SideOnly(Side.CLIENT)
@Override
public Optional<TRSRTransformation> applyTransformations(ItemStack stack, String group, Optional<TRSRTransformation> transform) {
    if (transform.isPresent()) {
        NBTTagCompound upgrades = this.getUpgrades(stack);
        if (group.equals("drill_head") && upgrades.getInteger("damage") <= 0) {
            Matrix4 mat = new Matrix4(transform.get().getMatrix());
            mat.translate(-.25f, 0, 0);
            return Optional.of(new TRSRTransformation(mat.toMatrix4f()));
        }
        if (group.equals("upgrade_damage1") || group.equals("upgrade_damage2") || group.equals("upgrade_damage3") || group.equals("upgrade_damage4")) {
            Matrix4 mat = new Matrix4(transform.get().getMatrix());
            mat.translate(.441f, 0, 0);
            return Optional.of(new TRSRTransformation(mat.toMatrix4f()));
        }
    }
    return transform;
}
Also used : TRSRTransformation(net.minecraftforge.common.model.TRSRTransformation) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Matrix4(blusunrize.immersiveengineering.common.util.chickenbones.Matrix4) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 25 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project ImmersiveEngineering by BluSunrize.

the class ItemBullet method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
    if (stack.getItemDamage() == 2) {
        String key = ItemNBTHelper.getString(stack, "bullet");
        IBullet bullet = BulletHandler.getBullet(key);
        if (bullet != null)
            bullet.addTooltip(stack, player, list, advanced);
    }
}
Also used : IBullet(blusunrize.immersiveengineering.api.tool.BulletHandler.IBullet) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) ITextureOverride(blusunrize.immersiveengineering.common.items.IEItemInterfaces.ITextureOverride)

Aggregations

SideOnly (net.minecraftforge.fml.relauncher.SideOnly)175 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)42 ItemStack (net.minecraft.item.ItemStack)36 ResourceLocation (net.minecraft.util.ResourceLocation)30 IBlockState (net.minecraft.block.state.IBlockState)19 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)19 Block (net.minecraft.block.Block)17 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)13 EntityPlayer (net.minecraft.entity.player.EntityPlayer)11 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)9 BlockPos (net.minecraft.util.math.BlockPos)9 World (net.minecraft.world.World)9 TileEntity (net.minecraft.tileentity.TileEntity)8 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)8 Vec3d (net.minecraft.util.math.Vec3d)7 ArrayList (java.util.ArrayList)5 Minecraft (net.minecraft.client.Minecraft)5 Tessellator (net.minecraft.client.renderer.Tessellator)5 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)5 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)5