Search in sources :

Example 1 with RadiationEnum

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));
            }
        }
    }
}
Also used : RadiationEnum(minechem.radiation.RadiationEnum) PharmacologyEffect(minechem.potion.PharmacologyEffect) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 2 with RadiationEnum

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));
}
Also used : RadiationEnum(minechem.radiation.RadiationEnum) ChemicalRoomStateEnum(minechem.item.ChemicalRoomStateEnum) ElementClassificationEnum(minechem.item.element.ElementClassificationEnum) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 3 with RadiationEnum

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;
        }
    }
}
Also used : RadiationInfo(minechem.radiation.RadiationInfo) RadiationEnum(minechem.radiation.RadiationEnum) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 4 with RadiationEnum

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"));
        }
    }
}
Also used : RadiationEnum(minechem.radiation.RadiationEnum) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 5 with RadiationEnum

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;
}
Also used : RadiationInfo(minechem.radiation.RadiationInfo) RadiationEnum(minechem.radiation.RadiationEnum)

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