Search in sources :

Example 6 with RadiationEnum

use of minechem.radiation.RadiationEnum in project Minechem by iopleke.

the class MinechemBucketItem method addInformation.

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
    list.add(Constants.TEXT_MODIFIER + "9" + getFillLocalizedName());
    list.add(Constants.TEXT_MODIFIER + "9" + MinechemUtil.subscriptNumbers(getFormula()));
    String radioactivityColor;
    RadiationEnum radioactivity = RadiationInfo.getRadioactivity(itemstack);
    switch(radioactivity) {
        case stable:
            radioactivityColor = Constants.TEXT_MODIFIER + "7";
            break;
        case hardlyRadioactive:
            radioactivityColor = Constants.TEXT_MODIFIER + "a";
            break;
        case slightlyRadioactive:
            radioactivityColor = Constants.TEXT_MODIFIER + "2";
            break;
        case radioactive:
            radioactivityColor = Constants.TEXT_MODIFIER + "e";
            break;
        case highlyRadioactive:
            radioactivityColor = Constants.TEXT_MODIFIER + "6";
            break;
        case extremelyRadioactive:
            radioactivityColor = Constants.TEXT_MODIFIER + "4";
            break;
        default:
            radioactivityColor = "";
            break;
    }
    String radioactiveName = MinechemUtil.getLocalString("element.property." + radioactivity.name(), true);
    String timeLeft = "";
    if (RadiationInfo.getRadioactivity(itemstack) != RadiationEnum.stable && itemstack.getTagCompound() != null) {
        long worldTime = player.worldObj.getTotalWorldTime();
        timeLeft = TimeHelper.getTimeFromTicks(RadiationInfo.getRadioactivity(itemstack).getLife() - (worldTime - itemstack.getTagCompound().getLong("decayStart")));
    }
    list.add(radioactivityColor + radioactiveName + (timeLeft.equals("") ? "" : " (" + timeLeft + ")"));
}
Also used : RadiationEnum(minechem.radiation.RadiationEnum) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 7 with RadiationEnum

use of minechem.radiation.RadiationEnum in project Minechem by iopleke.

the class MinechemBucketHandler method fillCustomBucket.

private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) {
    Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ);
    Item bucket = buckets.get(block);
    if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) {
        ItemStack stack = new ItemStack(bucket);
        TileEntity tile = world.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
        RadiationEnum radiation = ((MinechemBucketItem) bucket).chemical.radioactivity();
        if (tile != null && radiation != RadiationEnum.stable && tile instanceof RadiationFluidTileEntity && ((RadiationFluidTileEntity) tile).info != null) {
            RadiationInfo.setRadiationInfo(((RadiationFluidTileEntity) tile).info, stack);
        }
        world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ);
        return stack;
    } else {
        return null;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) RadiationFluidTileEntity(minechem.radiation.RadiationFluidTileEntity) Item(net.minecraft.item.Item) RadiationFluidTileEntity(minechem.radiation.RadiationFluidTileEntity) RadiationEnum(minechem.radiation.RadiationEnum) Block(net.minecraft.block.Block) MinechemFluidBlock(minechem.fluid.MinechemFluidBlock) ItemStack(net.minecraft.item.ItemStack)

Aggregations

RadiationEnum (minechem.radiation.RadiationEnum)7 SideOnly (cpw.mods.fml.relauncher.SideOnly)3 RadiationInfo (minechem.radiation.RadiationInfo)2 MinechemFluidBlock (minechem.fluid.MinechemFluidBlock)1 ChemicalRoomStateEnum (minechem.item.ChemicalRoomStateEnum)1 ElementClassificationEnum (minechem.item.element.ElementClassificationEnum)1 PharmacologyEffect (minechem.potion.PharmacologyEffect)1 RadiationFluidTileEntity (minechem.radiation.RadiationFluidTileEntity)1 Block (net.minecraft.block.Block)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ZenMethod (stanhebben.zenscript.annotations.ZenMethod)1