Java Code Examples for gregtech.api.enums.Materials#getProtons()

The following examples show how to use gregtech.api.enums.Materials#getProtons() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BW_Util.java    From bartworks with MIT License 5 votes vote down vote up
public static int calculateSv(Materials materials) {
    for (BioVatLogicAdder.MaterialSvPair pair : BioVatLogicAdder.RadioHatch.getMaSv()) {
        if (pair.getMaterials().equals(materials))
            return pair.getSievert();
    }
    return (int) (materials.getProtons() == 43L ? (materials.equals(Materials.NaquadahEnriched) ? 140 : materials.equals(Materials.Naquadria) ? 150 : materials.equals(Materials.Naquadah) ? 130 : 43) : materials.getProtons());
}
 
Example 2
Source File: BWRecipes.java    From bartworks with MIT License 5 votes vote down vote up
@Deprecated
public boolean addBacterialVatRecipe(ItemStack[] aInputs, ItemStack[] aOutputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, Materials material, @Nonnegative byte glasTier) {
    int aSievert = 0;
    if (material.getProtons() >= 83 || material.getProtons() == 61 || material.getProtons() == 43)
        aSievert += calculateSv(material);
    aSievert = aSievert << 6;
    aSievert = aSievert | glasTier;
    return sBacteriaVat.addRecipe(new BacteriaVatRecipe(false, aInputs, aOutputs, null, new int[]{}, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSievert)) != null;
}
 
Example 3
Source File: BWRecipes.java    From bartworks with MIT License 5 votes vote down vote up
public boolean addBacterialVatRecipe(ItemStack[] aInputs, BioCulture aCulture, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, Materials material, @Nonnegative int glasTier, int aSpecialValue, boolean exactSv) {
    byte gTier = (byte) glasTier;
    int aSievert = 0;
    if (material.getProtons() >= 83 || material.getProtons() == 61 || material.getProtons() == 43)
        aSievert += calculateSv(material);
    aSievert = aSievert << 1;
    aSievert = aSievert | (exactSv ? 1 : 0);
    aSievert = aSievert << 2;
    aSievert = aSievert | specialToByte(aSpecialValue);
    aSievert = aSievert << 4;
    aSievert = aSievert | gTier;
    return sBacteriaVat.addRecipe(new BacteriaVatRecipe(false, aInputs, null, BioItemList.getPetriDish(aCulture), new int[]{}, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSievert)) != null;
}
 
Example 4
Source File: BWRecipes.java    From bartworks with MIT License 5 votes vote down vote up
@Deprecated
public boolean addBacterialVatRecipe(ItemStack[] aInputs, ItemStack[] aOutputs, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, Materials material, boolean exactSv) {
    int aSievert = 0;
    if (material.getProtons() >= 83 || material.getProtons() == 61 || material.getProtons() == 43)
        aSievert += calculateSv(material);
    aSievert = aSievert << 1;
    aSievert = aSievert | (exactSv ? 1 : 0);
    aSievert = aSievert << 6;
    return sBacteriaVat.addRecipe(new BacteriaVatRecipe(false, aInputs, aOutputs, null, new int[]{}, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSievert)) != null;
}
 
Example 5
Source File: BWRecipes.java    From bartworks with MIT License 5 votes vote down vote up
public boolean addBacterialVatRecipe(ItemStack[] aInputs, BioCulture culture, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, Materials material, int aSpecialValue, boolean exactSv) {
    int aSievert = 0;
    if (material.getProtons() >= 83 || material.getProtons() == 61 || material.getProtons() == 43)
        aSievert += calculateSv(material);
    aSievert = aSievert << 1;
    aSievert = aSievert | (exactSv ? 1 : 0);
    aSievert = aSievert << 2;
    aSievert = aSievert | specialToByte(aSpecialValue);
    aSievert = aSievert << 4;
    return sBacteriaVat.addRecipe(new BacteriaVatRecipe(false, aInputs, null, BioItemList.getPetriDish(culture), new int[]{}, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSievert)) != null;
}
 
Example 6
Source File: BWRecipes.java    From bartworks with MIT License 5 votes vote down vote up
public boolean addTrimmedBacterialVatRecipe(ItemStack[] aInputs, BioCulture aCulture, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, Materials material, @Nonnegative int glasTier, int aSpecialValue, boolean exactSv) {
    byte gTier = (byte) glasTier;
    int aSievert = 0;
    if (material.getProtons() >= 83 || material.getProtons() == 61 || material.getProtons() == 43)
        aSievert += material.getProtons();
    aSievert = aSievert << 1;
    aSievert = aSievert | (exactSv ? 1 : 0);
    aSievert = aSievert << 2;
    aSievert = aSievert | specialToByte(aSpecialValue);
    aSievert = aSievert << 4;
    aSievert = aSievert | gTier;
    return sBacteriaVat.addRecipe(new BacteriaVatRecipe(true, aInputs, null, BioItemList.getPetriDish(aCulture), new int[]{}, aFluidInputs, aFluidOutputs, aDuration, aEUt, aSievert)) != null;
}
 
Example 7
Source File: GT_MetaTileEntity_RadioHatch.java    From bartworks with MIT License 4 votes vote down vote up
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
    if (this.getBaseMetaTileEntity().isServerSide()) {

        if (this.mass > 0)
            ++this.timer;

        if (this.mass > 0 && this.sievert > 0 && GT_MetaTileEntity_RadioHatch.calcDecayTicks(this.sievert) > 0) {
            if (this.timer % (GT_MetaTileEntity_RadioHatch.calcDecayTicks(this.sievert)) == 0) {
                this.mass--;
                if (this.mass == 0) {
                    this.material = StatCollector.translateToLocal("tooltip.bw.empty.name");
                    this.sievert = 0;
                }
                this.timer = 1;
            }
        }

        ItemStack lStack = this.mInventory[0];

        if (lStack == null)
            return;

        IRadMaterial radmat = null;
        //gt++ compat
        if (LoaderReference.miscutils)
            radmat = RadioHatchCompat.GTppRadChecker(lStack);

        if (lStack.getItem() instanceof IRadMaterial || radmat != null) {
            if (radmat == null)
                radmat = ((IRadMaterial) lStack.getItem());
            int sv = radmat.getRadiationLevel(lStack);
            if (sv > BioVatLogicAdder.RadioHatch.getMaxSv())
                BioVatLogicAdder.RadioHatch.MaxSV = sv;
            if (this.mass == 0 || this.sievert == sv) {
                if (this.mass + radmat.getAmountOfMaterial(lStack) <= this.cap) {
                    this.mass += radmat.getAmountOfMaterial(lStack);
                    this.sievert = sv;
                    this.mInventory[0].stackSize--;
                    this.updateSlots();
                    this.colorForGUI = radmat.getColorForGUI(lStack);
                    this.material = radmat.getNameForGUI(lStack);
                    return;
                }
            }
        }

        for (ItemStack varStack : BioVatLogicAdder.RadioHatch.getIsSv().keySet()) {
            if (GT_Utility.areStacksEqual(varStack, lStack, true)) {
                if (this.mass == 0 || this.sievert == BioVatLogicAdder.RadioHatch.getIsSv().get(varStack)) {
                    int massToAdd = BioVatLogicAdder.RadioHatch.getIsKg().getOrDefault(varStack,1);
                    if (this.mass + massToAdd <= this.cap) {
                        this.mass += massToAdd;
                        this.sievert = BioVatLogicAdder.RadioHatch.getIsSv().get(varStack);
                        this.mInventory[0].stackSize--;
                        this.updateSlots();
                        this.colorForGUI = BioVatLogicAdder.RadioHatch.getIsColor().get(varStack);
                        this.material = StatCollector.translateToLocal(varStack.getUnlocalizedName());
                        return;
                    }
                }
            }
        }

        //check material for general validity
        if (GT_OreDictUnificator.getAssociation(lStack) != null && GT_OreDictUnificator.getAssociation(lStack).mMaterial != null && GT_OreDictUnificator.getAssociation(lStack).mMaterial.mMaterial != null) {
            //check orePrefix for general validity
            if (GT_OreDictUnificator.getAssociation(lStack).mPrefix != null) {
                OrePrefixes orePrefixes = GT_OreDictUnificator.getAssociation(lStack).mPrefix;
                //check orePrefix for specialised validity
                if (orePrefixes.equals(OrePrefixes.stickLong) || orePrefixes.equals(OrePrefixes.stick)) {
                    Materials materials = GT_OreDictUnificator.getAssociation(lStack).mMaterial.mMaterial;
                    //check material for specialised validity
                    if (materials.getProtons() >= 83 && materials.getProtons() != 125 || materials.getProtons() == 61 || materials.getProtons() == 43) {
                        if (this.mass == 0 || this.sievert == calculateSv(materials)) {
                            if ((this.mass + (orePrefixes.equals(OrePrefixes.stickLong) ? 2 : 1)) <= this.cap) {
                                this.sievert = calculateSv(materials);
                                this.mass += orePrefixes.equals(OrePrefixes.stickLong) ? 2 : 1;
                                this.mInventory[0].stackSize--;
                                this.updateSlots();
                                this.colorForGUI = materials.mColor.mRGBa;
                                this.material = materials.mName;
                            }
                        }
                    }
                }
            }
        }


    }
}