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 + ")"));
}
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;
}
}
Aggregations