use of minechem.radiation.RadiationEnum in project Minechem by iopleke.
the class MoleculeItem method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add("\u00A79" + getFormulaWithSubscript(itemstack));
RadiationEnum radioactivity = RadiationInfo.getRadioactivity(itemstack);
String radioactivityColor = radioactivity.getColour();
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 + ")"));
list.add(getRoomState(itemstack));
MoleculeEnum molecule = MoleculeEnum.getById(itemstack.getItemDamage());
if (PharmacologyEffectRegistry.hasEffect(molecule) && Settings.displayMoleculeEffects) {
if (PolytoolHelper.getTypeFromElement(ElementItem.getElement(itemstack), 1) != null) {
// Polytool Detail
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
for (PharmacologyEffect effect : PharmacologyEffectRegistry.getEffects(molecule)) {
list.add(effect.getColour() + effect.toString());
}
} else {
list.add(EnumColour.DARK_GREEN + MinechemUtil.getLocalString("effect.information", true));
}
}
}
}
use of minechem.radiation.RadiationEnum in project Minechem by iopleke.
the class Chemicals method addElement.
@ZenMethod
public static void addElement(int id, String name, String descriptiveName, String classification, String roomState, String radioactivity) {
if (id < 0) {
throw new IllegalArgumentException(id + " is invalid");
}
if (ElementEnum.getByID(id) != null) {
throw new IllegalArgumentException(id + ": " + name + " is already registered as an element");
}
ElementClassificationEnum eClass = InputHelper.getClassification(classification);
ChemicalRoomStateEnum state = InputHelper.getRoomState(roomState);
RadiationEnum radiation = InputHelper.getRadiation(radioactivity);
MineTweakerAPI.apply(new AddElementAction(id, name, descriptiveName, eClass, state, radiation));
}
use of minechem.radiation.RadiationEnum in project Minechem by iopleke.
the class ElementItem method getRadiationInfo.
public static RadiationInfo getRadiationInfo(ItemStack element, World world) {
RadiationEnum radioactivity = RadiationInfo.getRadioactivity(element);
if (radioactivity == RadiationEnum.stable) {
return new RadiationInfo(element, radioactivity);
} else {
NBTTagCompound stackTag = element.getTagCompound();
if (stackTag == null) {
return initiateRadioactivity(element, world);
} else {
int dimensionID = stackTag.getInteger("dimensionID");
long lastUpdate = stackTag.getLong("lastUpdate");
long decayStart = stackTag.getLong("decayStart");
RadiationInfo info = new RadiationInfo(element, decayStart, lastUpdate, dimensionID, radioactivity);
return info;
}
}
}
use of minechem.radiation.RadiationEnum in project Minechem by iopleke.
the class ElementItem method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
if (itemstack.getItemDamage() == 0) {
return;
}
list.add(Constants.TEXT_MODIFIER + "9" + getShortName(itemstack) + " (" + (itemstack.getItemDamage()) + ")");
RadiationEnum radioactivity = RadiationInfo.getRadioactivity(itemstack);
String radioactivityColor = radioactivity.getColour();
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 + ")"));
list.add(getClassification(itemstack));
list.add(getRoomState(itemstack));
if (PolytoolHelper.getTypeFromElement(ElementItem.getElement(itemstack), 1) != null) {
// Polytool Detail
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
String polytoolDesc = PolytoolHelper.getTypeFromElement(ElementItem.getElement(itemstack), 1).getDescription();
String localizedDesc = StatCollector.translateToLocal("polytool.description." + ElementItem.getShortName(itemstack));
if (!StatCollector.canTranslate("polytool.description." + ElementItem.getShortName(itemstack))) {
localizedDesc = polytoolDesc;
}
list.add(EnumColour.AQUA + localizedDesc);
} else {
list.add(EnumColour.DARK_GREEN + MinechemUtil.getLocalString("polytool.information"));
}
}
}
use of minechem.radiation.RadiationEnum in project Minechem by iopleke.
the class ElementItem method initiateRadioactivity.
public static RadiationInfo initiateRadioactivity(ItemStack element, World world) {
RadiationEnum radioactivity = RadiationInfo.getRadioactivity(element);
int dimensionID = world.provider.dimensionId;
long lastUpdate = world.getTotalWorldTime();
RadiationInfo info = new RadiationInfo(element, lastUpdate, lastUpdate, dimensionID, radioactivity);
RadiationInfo.setRadiationInfo(info, element);
return info;
}
Aggregations