Search in sources :

Example 6 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class MaterialAbsorberBlock method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> list, boolean whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);
    NBTTagCompound tagCompound = itemStack.getTagCompound();
    if (tagCompound != null && tagCompound.hasKey("block")) {
        Block block = Block.REGISTRY.getObject(new ResourceLocation(tagCompound.getString("block")));
        if (block != null) {
            int meta = tagCompound.getInteger("meta");
            if (Item.getItemFromBlock(block) == null) {
                list.add(TextFormatting.RED + "Block: ERROR");
            } else {
                list.add(TextFormatting.GREEN + "Block: " + new ItemStack(block, 1, meta).getDisplayName());
            }
            int absorbing = tagCompound.getInteger("absorbing");
            int pct = ((DimletConstructionConfiguration.maxBlockAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxBlockAbsorbtion;
            list.add(TextFormatting.GREEN + "Absorbed: " + pct + "%");
        }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
        list.add(TextFormatting.WHITE + "Place this block on top of another block and it will");
        list.add(TextFormatting.WHITE + "gradually absorb all identical blocks in the area.");
        list.add(TextFormatting.WHITE + "You can use the end result in the Dimlet Workbench.");
    } else {
        list.add(TextFormatting.WHITE + RFToolsDim.SHIFT_MESSAGE);
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Block(net.minecraft.block.Block) GenericRFToolsBlock(mcjty.rftoolsdim.blocks.GenericRFToolsBlock) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 7 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class MaterialAbsorberBlock method getWailaBody.

@SideOnly(Side.CLIENT)
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
    super.getWailaBody(itemStack, currenttip, accessor, config);
    MaterialAbsorberTileEntity tileEntity = (MaterialAbsorberTileEntity) accessor.getTileEntity();
    if (tileEntity != null && tileEntity.getBlockState() != null) {
        Block block = tileEntity.getBlockState().getBlock();
        int meta = block.getMetaFromState(tileEntity.getBlockState());
        int absorbing = tileEntity.getAbsorbing();
        int pct = ((DimletConstructionConfiguration.maxBlockAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxBlockAbsorbtion;
        currenttip.add(TextFormatting.GREEN + "Block: " + new ItemStack(block, 1, meta).getDisplayName() + " (" + pct + "%)");
    }
    return currenttip;
}
Also used : Block(net.minecraft.block.Block) GenericRFToolsBlock(mcjty.rftoolsdim.blocks.GenericRFToolsBlock) ItemStack(net.minecraft.item.ItemStack) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 8 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class LiquidAbsorberBlock method getWailaBody.

@SideOnly(Side.CLIENT)
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
    super.getWailaBody(itemStack, currenttip, accessor, config);
    LiquidAbsorberTileEntity tileEntity = (LiquidAbsorberTileEntity) accessor.getTileEntity();
    if (tileEntity != null && tileEntity.getBlock() != null) {
        Block block = tileEntity.getBlock();
        Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
        if (fluid != null) {
            int absorbing = tileEntity.getAbsorbing();
            int pct = ((DimletConstructionConfiguration.maxLiquidAbsorbtion - absorbing) * 100) / DimletConstructionConfiguration.maxLiquidAbsorbtion;
            currenttip.add(TextFormatting.GREEN + "Liquid: " + new FluidStack(fluid, 1).getLocalizedName() + " (" + pct + "%)");
        }
    }
    return currenttip;
}
Also used : FluidStack(net.minecraftforge.fluids.FluidStack) Fluid(net.minecraftforge.fluids.Fluid) Block(net.minecraft.block.Block) GenericRFToolsBlock(mcjty.rftoolsdim.blocks.GenericRFToolsBlock) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 9 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class RealizedDimensionTab method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> list, boolean whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);
    NBTTagCompound tagCompound = itemStack.getTagCompound();
    if (tagCompound != null) {
        String name = tagCompound.getString("name");
        int id = 0;
        if (name != null) {
            id = tagCompound.getInteger("id");
            if (id == 0) {
                list.add(TextFormatting.BLUE + "Name: " + name);
            } else {
                list.add(TextFormatting.BLUE + "Name: " + name + " (Id " + id + ")");
            }
        }
        String descriptionString = tagCompound.getString("descriptionString");
        constructDescriptionHelp(list, descriptionString);
        Integer ticksLeft = tagCompound.getInteger("ticksLeft");
        if (ticksLeft == 0) {
            DimensionInformation information = RfToolsDimensionManager.getDimensionManager(player.getEntityWorld()).getDimensionInformation(id);
            if (information == null) {
                list.add(TextFormatting.RED + "Dimension information Missing!");
            } else {
                list.add(TextFormatting.BLUE + "Dimension ready!");
                int maintainCost = tagCompound.getInteger("rfMaintainCost");
                int actualCost = information.getActualRfCost();
                if (actualCost == maintainCost || actualCost == 0) {
                    list.add(TextFormatting.YELLOW + "    Maintenance cost: " + maintainCost + " RF/tick");
                } else {
                    list.add(TextFormatting.YELLOW + "    Maintenance cost: " + actualCost + " RF/tick (Specified: " + maintainCost + " RF/tick)");
                }
                if (id != 0) {
                    if (System.currentTimeMillis() - lastTime > 500) {
                        lastTime = System.currentTimeMillis();
                        RFToolsDimMessages.INSTANCE.sendToServer(new PacketGetDimensionEnergy(id));
                    }
                    DimensionStorage storage = DimensionStorage.getDimensionStorage(player.getEntityWorld());
                    int power = storage.getEnergyLevel(id);
                    list.add(TextFormatting.YELLOW + "    Current power: " + power + " RF");
                }
            }
        } else {
            int createCost = tagCompound.getInteger("rfCreateCost");
            int maintainCost = tagCompound.getInteger("rfMaintainCost");
            int tickCost = tagCompound.getInteger("tickCost");
            int percentage = (tickCost - ticksLeft) * 100 / tickCost;
            list.add(TextFormatting.BLUE + "Dimension progress: " + percentage + "%");
            list.add(TextFormatting.YELLOW + "    Creation cost: " + createCost + " RF/tick");
            list.add(TextFormatting.YELLOW + "    Maintenance cost: " + maintainCost + " RF/tick");
            list.add(TextFormatting.YELLOW + "    Tick cost: " + tickCost + " ticks");
        }
    }
}
Also used : DimensionStorage(mcjty.rftoolsdim.dimensions.DimensionStorage) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) DimensionInformation(mcjty.rftoolsdim.dimensions.DimensionInformation) PacketGetDimensionEnergy(mcjty.rftoolsdim.network.PacketGetDimensionEnergy) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 10 with SideOnly

use of net.minecraftforge.fml.relauncher.SideOnly in project RFToolsDimensions by McJty.

the class DimensionModuleItem method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);
    list.add(TextFormatting.GREEN + "Uses " + GeneralConfiguration.DIMENSIONMODULE_RFPERTICK + " RF/tick");
    NBTTagCompound tagCompound = itemStack.getTagCompound();
    if (tagCompound != null) {
        list.add(TextFormatting.YELLOW + "Label: " + tagCompound.getString("text"));
        list.add(TextFormatting.YELLOW + "Dimension: " + tagCompound.getInteger("dim"));
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

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