diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-26 15:46:55 +0100 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-26 15:46:55 +0100 |
commit | 2cf05c4deaf3a26626853431f725d0ca375ffec3 (patch) | |
tree | 025ae135b88af6b9a0437a3721bcc2dec9ccc3e3 | |
parent | e9dbe58c39b56d562bcdc17b1100a7c26ce7c10e (diff) | |
download | GT5-Unofficial-2cf05c4deaf3a26626853431f725d0ca375ffec3.tar.gz GT5-Unofficial-2cf05c4deaf3a26626853431f725d0ca375ffec3.tar.bz2 GT5-Unofficial-2cf05c4deaf3a26626853431f725d0ca375ffec3.zip |
+ Added 4 new High-Tier Alloys. Lafium, Cinobite, Pikyonite & Abyssal.
+ Added missing Germanium Dust.
+ Added compatibility for Witchery.
- Removed portability of Tanks for GTNH, tanks are still portable otherwise.
$ Fixed calculations for automatic recipe generation, EBF and ABS recipe requirements for GT++ Alloys are now significantly increased.
$ Fixed missing Control Core textures.
% Cleaned up some recipe generation.
% Improved Material.java.
22 files changed, 667 insertions, 321 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java index 8cb165ccb2..f994c40b52 100644 --- a/src/Java/gtPlusPlus/api/objects/Logger.java +++ b/src/Java/gtPlusPlus/api/objects/Logger.java @@ -112,15 +112,15 @@ public class Logger { * Special Logger for Materials related content */ public static void MATERIALS(final String s) { - /*if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Materials] "+s);*/ + if (CORE.DEVENV || CORE.DEBUG) + modLogger.info("[Materials] "+s); } /** * Special Logger for Debugging Materials related content */ public static void DEBUG_MATERIALS(final String s) { - /*if (CORE.DEVENV || CORE.DEBUG) - modLogger.info("[Debug][Materials] "+s);*/ + if (CORE.DEVENV || CORE.DEBUG) + modLogger.info("[Debug][Materials] "+s); } /** diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java new file mode 100644 index 0000000000..cde6e3ae98 --- /dev/null +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Witchery.java @@ -0,0 +1,26 @@ +package gtPlusPlus.core.common.compat; + +import static gtPlusPlus.core.lib.LoadedMods.Witchery; + +import gregtech.api.util.GT_OreDictUnificator; + +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.item.ItemStack; + +public class COMPAT_Witchery { + + public static void OreDict(){ + run(); + } + + private static final void run(){ + //Koboldite + ItemStack aKobolditeDust = ItemUtils.getItemStackWithMeta(Witchery, "witchery:ingredient", "Koboldite Dust", 148, 1); + ItemStack aKobolditeNugget = ItemUtils.getItemStackWithMeta(Witchery, "witchery:ingredient", "Koboldite Nugget", 149, 1); + ItemStack aKobolditeIngot = ItemUtils.getItemStackWithMeta(Witchery, "witchery:ingredient", "Koboldite Ingot", 150, 1); + if (aKobolditeDust != null) GT_OreDictUnificator.registerOre("dust"+"Koboldite", aKobolditeDust); + if (aKobolditeNugget != null) GT_OreDictUnificator.registerOre("nugget"+"Koboldite", aKobolditeNugget); + if (aKobolditeIngot != null) GT_OreDictUnificator.registerOre("ingot"+"Koboldite", aKobolditeIngot); + } + +} diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index c43fa3c9c0..c37369b00f 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -163,6 +163,9 @@ public class COMPAT_HANDLER { if (LoadedMods.PamsHarvestcraft){ COMPAT_HarvestCraft.OreDict(); } + if (LoadedMods.Witchery) { + COMPAT_Witchery.OreDict(); + } } public static void RemoveRecipesFromOtherMods(){ diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index eda11d2a38..5b8e8ab2a1 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -2,6 +2,8 @@ package gtPlusPlus.core.item; import static gtPlusPlus.core.creative.AddToCreativeTab.*; import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT; +import com.ibm.icu.util.RangeValueIterator.Element; + import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.item.*; @@ -368,9 +370,9 @@ public final class ModItems { if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustLanthanum", 1) == null){ ItemUtils.generateSpecialUseDusts("Lanthanum", "Lanthanum", Materials.Lanthanum.mElement.name(), Utils.rgbtoHexValue(106, 127, 163)); } - /*if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGadolinium", 1) == null){ - ItemUtils.generateSpecialUseDusts("Gadolinium", "Gadolinium", "", Utils.rgbtoHexValue(Materials.Gadolinium.mRGBa[0], Materials.Gadolinium.mRGBa[1], Materials.Gadolinium.mRGBa[2])); - }*/ + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGermanium", 1) == null){ + ItemUtils.generateSpecialUseDusts("Germanium", "Germanium", "Ge", ELEMENT.getInstance().GERMANIUM.getRgbAsHex()); + } //Elements generate first so they can be used in compounds. @@ -527,13 +529,20 @@ public final class ModItems { } MaterialGenerator.generate(ALLOY.TRINIUM_TITANIUM); MaterialGenerator.generate(ALLOY.TRINIUM_NAQUADAH, false); - MaterialGenerator.generate(ALLOY.TRINIUM_NAQUADAH_CARBON); - + MaterialGenerator.generate(ALLOY.TRINIUM_NAQUADAH_CARBON); + + //Top Tier Alloys + MaterialGenerator.generate(ALLOY.LAFIUM); + MaterialGenerator.generate(ALLOY.CINOBITE); + MaterialGenerator.generate(ALLOY.PIKYONIUM); + MaterialGenerator.generate(ALLOY.ABYSSAL); + //Must be the final Alloy to Generate MaterialGenerator.generate(ALLOY.QUANTUM); //Ores MaterialGenerator.generateOreMaterial(FLUORIDES.FLUORITE); + MaterialGenerator.generateOreMaterial(ALLOY.KOBOLDITE); GTplusplus_Everglades.GenerateOreMaterials(); diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 6b4e3d8f4e..2be7b76f6c 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -123,22 +123,21 @@ public class BaseItemDust extends Item{ protected final int sRadiation; @Override public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding); + + if (this.dustInfo != null){ + if (entityHolding instanceof EntityPlayer){ + if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){ + EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.dustInfo.vRadiationLevel, world, entityHolding); + } + } + } + } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { - //if (pileType != null && materialName != null && pileType != "" && materialName != "" && !pileType.equals("") && !materialName.equals("")){ - /*if (getUnlocalizedName().contains("DustTiny")){ - list.add(EnumChatFormatting.GRAY+"A tiny pile of " + materialName + " dust."); - } - else if (getUnlocalizedName().contains("DustSmall")){ - list.add(EnumChatFormatting.GRAY+"A small pile of " + materialName + " dust."); - } - else { - list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust."); - }*/ + if (stack.getDisplayName().equalsIgnoreCase("fluorite")){ list.add("Mined from Sandstone and Limestone."); } @@ -167,143 +166,61 @@ public class BaseItemDust extends Item{ } - private void addMacerationRecipe(){ - Logger.WARNING("Adding recipe for "+this.materialName+" Dusts"); - - String tempIngot = this.getUnlocalizedName().replace("item.itemDust", "ingot"); - final String tempDust = this.getUnlocalizedName().replace("item.itemDust", "dust"); - ItemStack tempInputStack; - ItemStack tempOutputStack; + private void addMacerationRecipe(){ - if (this.getUnlocalizedName().contains("DustSmall") || this.getUnlocalizedName().contains("DustTiny")){ - return; - } + Logger.MATERIALS("Adding Maceration recipe for "+this.materialName+" Ingot -> Dusts"); + final int chance = (this.mTier*10)/MathUtils.randInt(10, 20); + GT_ModHandler.addPulverisationRecipe(dustInfo.getIngot(1), dustInfo.getDust(1), null, chance); + + } - Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName()); - if (this.getUnlocalizedName().contains("item.")){ - tempIngot = this.getUnlocalizedName().replace("item.", ""); - Logger.WARNING("Generating OreDict Name: "+tempIngot); - } - else { - tempIngot = this.getUnlocalizedName(); - } + private void addFurnaceRecipe(){ - tempIngot = tempIngot.replace("itemDust", "ingot"); - Logger.WARNING("Generating OreDict Name: "+tempIngot); - final ItemStack[] outputStacks = {this.dustInfo.getDust(1)}; - if ((tempIngot != null) && !tempIngot.equals("")){ - tempInputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); - tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempDust, 1); - ItemStack tempStackOutput2 = null; - final int chance = (this.mTier*10)/MathUtils.randInt(10, 20); - if (outputStacks.length != 0){ - if (outputStacks.length == 1){ - tempStackOutput2 = null; - } - else { - if (!outputStacks[1].getUnlocalizedName().toLowerCase().contains("aaa_broken")){ - tempStackOutput2 = outputStacks[1]; - tempOutputStack = outputStacks[0]; - } - else { - tempStackOutput2 = null; - } - } + ItemStack aDust = dustInfo.getDust(1); + ItemStack aOutput; + + if (this.dustInfo.requiresBlastFurnace()) { + aOutput = dustInfo.getHotIngot(1); + if (addBlastFurnaceRecipe(aDust, null, aOutput, null, dustInfo.getMeltingPointK())){ + Logger.MATERIALS("Successfully added a blast furnace recipe for "+this.materialName); } else { - tempStackOutput2 = null; - } - if ((null != tempOutputStack) && (null != tempInputStack)){ - if (ItemUtils.checkForInvalidItems(tempOutputStack) && ItemUtils.checkForInvalidItems(tempStackOutput2) && ItemUtils.checkForInvalidItems(tempInputStack)) { - GT_ModHandler.addPulverisationRecipe(tempInputStack, tempOutputStack.splitStack(1), tempStackOutput2, chance); - } + Logger.MATERIALS("Failed to add a blast furnace recipe for "+this.materialName); } } - } - - private void addFurnaceRecipe(){ - - String temp = ""; - if (this.getUnlocalizedName().contains("item.")){ - temp = this.getUnlocalizedName().replace("item.", ""); - } else { - temp = this.getUnlocalizedName(); - } - if (temp.contains("DustTiny") || temp.contains("DustSmall")){ - return; - } - temp = temp.replace("itemDust", "ingot"); - if ((temp != null) && !temp.equals("")){ - ItemStack mThisStack = ItemUtils.getSimpleStack(this); - if (this.dustInfo.requiresBlastFurnace()){ - Logger.WARNING("Adding recipe for Hot "+this.materialName+" Ingots in a Blast furnace."); - final String tempIngot = temp.replace("ingot", "ingotHot"); - final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); - if (null != tempOutputStack && tempOutputStack != ItemUtils.getSimpleStack(ModItems.AAA_Broken)){ - Logger.WARNING("This will produce "+tempOutputStack.getDisplayName() + " Debug: "+tempIngot); - if (ItemUtils.checkForInvalidItems(tempOutputStack) && ItemUtils.checkForInvalidItems(mThisStack)) { - this.addBlastFurnaceRecipe(mThisStack, null, tempOutputStack, null, 350*this.mTier); - } - } - return; + aOutput = dustInfo.getIngot(1); + if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)){ + Logger.MATERIALS("Successfully added a furnace recipe for "+this.materialName); } - Logger.WARNING("Adding recipe for "+this.materialName+" Ingots in a furnace."); - final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); - //Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp); - if (null != tempOutputStack && tempOutputStack != ItemUtils.getSimpleStack(ModItems.AAA_Broken)){ - if ((this.mTier < 5) || !this.dustInfo.requiresBlastFurnace()){ - if (ItemUtils.checkForInvalidItems(tempOutputStack) && ItemUtils.checkForInvalidItems(mThisStack)) { - if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this), tempOutputStack)){ - Logger.WARNING("Successfully added a furnace recipe for "+this.materialName); - } - else { - Logger.WARNING("Failed to add a furnace recipe for "+this.materialName); - } - } - } - else if ((this.mTier >= 5) || this.dustInfo.requiresBlastFurnace()){ - Logger.WARNING("Adding recipe for "+this.materialName+" Ingots in a Blast furnace."); - Logger.WARNING("This will produce "+tempOutputStack.getDisplayName()); - if (null != tempOutputStack && tempOutputStack != ItemUtils.getSimpleStack(ModItems.AAA_Broken)){ - if (ItemUtils.checkForInvalidItems(tempOutputStack) && ItemUtils.checkForInvalidItems(mThisStack)) { - this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*this.mTier); - } - } - return; - } + else { + Logger.MATERIALS("Failed to add a furnace recipe for "+this.materialName); } - } + } - private void addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ - //Special Cases - /*if (input1.getUnlocalizedName().toLowerCase().contains("tantalloy61")){ - Utils.LOG_INFO("Adding Special handler for Staballoy-61 in the Blast Furnace"); - input2 = UtilsItems.getItemStackOfAmountFromOreDict("dustTantalloy60", 2); - if (input2 == null){ - Utils.LOG_INFO("invalid itemstack."); - } - else { - Utils.LOG_INFO("Found "+input2.getDisplayName()); - } - }*/ + private boolean addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, final ItemStack output2, final int tempRequired){ - int timeTaken = 250*this.mTier*20; + int timeTaken = 125*this.mTier*20; if (this.mTier <= 4){ - timeTaken = 50*this.mTier*20; + timeTaken = 25*this.mTier*20; + } + int aSlot = mTier - 2; + if (aSlot < 2) { + aSlot = 2; } + long aVoltage = GT_Values.V[aSlot >= 2 ? aSlot : 2]; - GT_Values.RA.addBlastRecipe( + return GT_Values.RA.addBlastRecipe( input1, input2, GT_Values.NF, GT_Values.NF, output1, output2, timeTaken, - this.mTier*60, + (int) aVoltage, tempRequired); diff --git a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java index 3da3c18836..eea1aed49f 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/CoalTar.java @@ -47,23 +47,37 @@ public class CoalTar { Coal_Gas = FluidUtils.generateFluidNonMolten("CoalGas", "Coal Gas", 500, new short[]{48, 48, 48, 100}, null, null); //Ethanol // v - Dehydrate cells to remove water + + //Create Ethylene - Ethylene = FluidUtils.generateFluidNonMolten("Ethylene", "Ethylene", -103, new short[]{255, 255, 255, 100}, null, null); + if (!FluidUtils.doesFluidExist("Ethylene")){ + Ethylene = FluidUtils.generateFluidNonMolten("Ethylene", "Ethylene", -103, new short[]{255, 255, 255, 100}, null, null); + } + else { + Ethylene = FluidUtils.getWildcardFluidStack("Ethylene", 1).getFluid(); + } + //Create Benzene - (Toluene + Hydrogen | 95% Benzene / 5% methane) - Benzene = FluidUtils.generateFluidNonMolten("Benzene", "Benzene", 81, new short[]{150, 75, 0, 100}, null, null); + if (!FluidUtils.doesFluidExist("NitrousOxide")){ + Benzene = FluidUtils.generateFluidNonMolten("Benzene", "Benzene", 81, new short[]{150, 75, 0, 100}, null, null); + } + else { + Benzene = FluidUtils.getWildcardFluidStack("Benzene", 1).getFluid(); + } + //Create Ethylbenzene - Ethylbenzene is produced in on a large scale by combining benzene and ethylene in an acid-catalyzed chemical reaction //Use Chemical Reactor Ethylbenzene = FluidUtils.generateFluidNonMolten("Ethylbenzene", "Ethylbenzene", 136, new short[]{255, 255, 255, 100}, null, null); //Create Anthracene Anthracene = FluidUtils.generateFluidNonMolten("Anthracene", "Anthracene", 340, new short[]{255, 255, 255, 100}, null, null); - //Toluene - if (FluidUtils.getFluidStack("liquid_toluene", 1) == null){ + //Toluene + if (!FluidUtils.doesFluidExist("Toluene")){ Toluene = FluidUtils.generateFluidNonMolten("Toluene", "Toluene", -95, new short[]{140, 70, 20, 100}, null, null); } else { - Toluene = FluidUtils.getFluidStack("liquid_toluene", 1000).getFluid(); + Toluene = FluidUtils.getWildcardFluidStack("Toluene", 1).getFluid(); Item itemCellToluene = new BaseItemComponent("Toluene", "Toluene", new short[]{140, 70, 20, 100}); - MaterialGenerator.addFluidCannerRecipe(ItemUtils.getEmptyCell(), ItemUtils.getSimpleStack(itemCellToluene), FluidUtils.getFluidStack("liquid_toluene", 1000), null); + MaterialGenerator.addFluidCannerRecipe(ItemUtils.getEmptyCell(), ItemUtils.getSimpleStack(itemCellToluene), FluidUtils.getFluidStack(Toluene, 1000), null); } //Create Coal Tar diff --git a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java index 7b5a90a64e..9bd8a521ab 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/RocketFuels.java @@ -67,16 +67,11 @@ public class RocketFuels { Nitrous_Oxide = FluidUtils.generateFluidNonMolten("NitrousOxide", "Nitrous Oxide", -91, new short[]{255, 255, 255, 100}, null, null); //Nos - if (FluidUtils.getFluidStack("NitrousOxide", 1) == null && FluidUtils.getFluidStack("nitrousoxide", 1) == null){ + if (!FluidUtils.doesFluidExist("NitrousOxide")){ Nitrous_Oxide = FluidUtils.generateFluidNoPrefix("NitrousOxide", "Nitrous Oxide", -91, new short[]{255, 255, 255, 100}); } else { - if (FluidUtils.getFluidStack("NitrousOxide", 1) != null ) { - Nitrous_Oxide = FluidUtils.getFluidStack("NitrousOxide", 1).getFluid(); - } - else { - Nitrous_Oxide = FluidUtils.getFluidStack("nitrousoxide", 1).getFluid(); - } + Nitrous_Oxide = FluidUtils.getWildcardFluidStack("NitrousOxide", 1).getFluid(); if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellNitrousOxide", 1) == null){ new BaseItemComponent("NitrousOxide", "Nitrous Oxide", new short[] {10, 10, 175}); } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java b/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java index d8ec8944e9..8ad87c0ea8 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemControlCore.java @@ -10,7 +10,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; public class ItemControlCore extends Item { @@ -29,16 +28,16 @@ public class ItemControlCore extends Item { @Override public void registerIcons(IIconRegister reg) { - this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_0"); - this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_1"); - this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_2"); - this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_3"); - this.icons[4] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_4"); - this.icons[5] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_5"); - this.icons[6] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_6"); - this.icons[7] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_7"); - this.icons[8] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_8"); - this.icons[9] = reg.registerIcon(CORE.MODID + ":" + "controlcore/core_9"); + this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_0"); + this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_1"); + this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_2"); + this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_3"); + this.icons[4] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_4"); + this.icons[5] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_5"); + this.icons[6] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_6"); + this.icons[7] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_7"); + this.icons[8] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_8"); + this.icons[9] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_9"); } @Override @@ -46,6 +45,7 @@ public class ItemControlCore extends Item { return this.icons[meta]; } + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void getSubItems(Item item, CreativeTabs tab, List list) { for (int i = 0; i < 10; i ++) { diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 99092aed71..a6ffd96bbf 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -44,6 +44,7 @@ public class CORE { public static boolean DEVENV = false; public static boolean DEBUG = false; + public static boolean NBT_PERSISTENCY_PATCH_APPLIED = false; //Only can be set in Dev, no config or setting elsewhere. public static final boolean LOAD_ALL_CONTENT = false;; @@ -114,6 +115,7 @@ public class CORE { public static IGregtech_RecipeAdder sRecipeAdder; public static IGregtech_RecipeAdder RA; public static GregtechRecipe GT_Recipe = new GregtechRecipe(); + public static final GT_Materials[] sMU_GeneratedMaterials = new GT_Materials[1000]; /** diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index 5426bb1a6a..2a7ef9bc39 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -52,6 +52,7 @@ public class LoadedMods { public static boolean TecTech = false; //Technus' Mod public static boolean TiCon = false; public static boolean StevesCarts = false; + public static boolean Witchery = false; @@ -279,6 +280,11 @@ public class LoadedMods { TecTech = true; Logger.INFO("Components enabled for: TecTech"); totalMods++; + } + if (Loader.isModLoaded("witchery")){ + Witchery = true; + Logger.INFO("Components enabled for: Witchery"); + totalMods++; } Logger.INFO("Content found for "+totalMods+" mods"); diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index e42a3e5501..23cb359ec9 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -13,6 +13,9 @@ public final class ALLOY { public static final Material INVAR = MaterialUtils.generateMaterialFromGtENUM(Materials.Invar); public static final Material KANTHAL = MaterialUtils.generateMaterialFromGtENUM(Materials.Kanthal); public static final Material NICHROME = MaterialUtils.generateMaterialFromGtENUM(Materials.Nichrome); + public static final Material TUNGSTENSTEEL = MaterialUtils.generateMaterialFromGtENUM(Materials.TungstenSteel); + public static final Material STAINLESSSTEEL = MaterialUtils.generateMaterialFromGtENUM(Materials.StainlessSteel); + public static final Material OSMIRIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Osmiridium); public static final Material ENERGYCRYSTAL = new Material( "Energy Crystal", //Material Name @@ -614,14 +617,120 @@ public final class ALLOY { }); + public static final Material KOBOLDITE = new Material( + "Koboldite", //Material Name + MaterialState.SOLID, //State + new short[]{80, 210, 255, 0}, //Material Colour + -1, //Melting Point in C + -1, + -1, + -1, + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().NICKEL, 35), + new MaterialStack(ELEMENT.getInstance().THAUMIUM, 30), + new MaterialStack(ELEMENT.getInstance().IRON, 35) + }); + + /* + * Top Tier Alloys + */ + + //0lafe Compound + public static final Material LAFIUM = new Material( + "Lafium Compound", //Material Name + MaterialState.SOLID, //State + new short[]{75,180,255, 0}, //Material Colour + 6750, //Melting Point in C + 9865, //Boiling Point in C + -1, + -1, + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ALLOY.HASTELLOY_N, 8), + new MaterialStack(ELEMENT.getInstance().NAQUADAH, 4), + new MaterialStack(ELEMENT.getInstance().SAMARIUM, 2), + new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 4), + new MaterialStack(ELEMENT.getInstance().ARGON, 2), + new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 6), + new MaterialStack(ELEMENT.getInstance().NICKEL, 8), + new MaterialStack(ELEMENT.getInstance().CARBON, 2) + }); - + //Cinobi Alloy + public static final Material CINOBITE = new Material( + "Cinobite A243", //Material Name + MaterialState.SOLID, //State + new short[]{255,75,45, 0}, //Material Colour + 7350, //Melting Point in C + 12565, //Boiling Point in C + -1, + -1, + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ALLOY.ZERON_100, 16), + new MaterialStack(ELEMENT.getInstance().NAQUADRIA, 7), + new MaterialStack(ELEMENT.getInstance().GADOLINIUM, 5), + new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 3), + new MaterialStack(ELEMENT.getInstance().MERCURY, 2), + new MaterialStack(ELEMENT.getInstance().TIN, 2), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 12), + new MaterialStack(ALLOY.OSMIRIDIUM, 6) + }); + + //Piky Alloy + public static final Material PIKYONIUM = new Material( + "Pikyonium 64B", //Material Name + MaterialState.SOLID, //State + new short[]{110,255,20, 0}, //Material Colour + 7850, //Melting Point in C + 11765, //Boiling Point in C + -1, + -1, + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ALLOY.INCONEL_792, 16), + new MaterialStack(ALLOY.EGLIN_STEEL, 10), + new MaterialStack(ELEMENT.getInstance().NAQUADAH_ENRICHED, 8), + new MaterialStack(ELEMENT.getInstance().CERIUM, 6), + new MaterialStack(ELEMENT.getInstance().ANTIMONY, 4), + new MaterialStack(ELEMENT.getInstance().PLATINUM, 4), + new MaterialStack(ELEMENT.getInstance().YTTERBIUM, 2), + new MaterialStack(ALLOY.TUNGSTENSTEEL, 8) + }); + + //Piky Alloy + public static final Material ABYSSAL = new Material( + "Abyssal Alloy", //Material Name + MaterialState.SOLID, //State + new short[]{85,0,85, 0}, //Material Colour + 9650, //Melting Point in C + 13765, //Boiling Point in C + -1, + -1, + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ALLOY.STAINLESSSTEEL, 10), + new MaterialStack(ALLOY.TUNGSTEN_CARBIDE, 10), + new MaterialStack(ALLOY.NICHROME, 10), + new MaterialStack(ALLOY.BRONZE, 10), + new MaterialStack(ALLOY.INCOLOY_MA956, 10), + new MaterialStack(ELEMENT.getInstance().IODINE, 2), + new MaterialStack(ELEMENT.getInstance().RADON, 2), + new MaterialStack(ELEMENT.getInstance().GERMANIUM, 2), + }); + //Quantum public static final Material QUANTUM = new Material( "Quantum", //Material Name MaterialState.SOLID, //State new short[]{128, 128, 255, 50}, //Material Colour - 9999, //Melting Point in C + 9500, //Melting Point in C 25000, //Boiling Point in C 150, //Protons 200, //Neutrons diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index fd8df711e9..9f37164aa0 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -125,6 +125,8 @@ public final class ELEMENT { //Fictional public final Material YELLORIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Yellorium, new short[] {255, 242, 10}); public final Material NAQUADAH = MaterialUtils.generateMaterialFromGtENUM(Materials.Naquadah); + public final Material NAQUADAH_ENRICHED = MaterialUtils.generateMaterialFromGtENUM(Materials.NaquadahEnriched); + public final Material NAQUADRIA = MaterialUtils.generateMaterialFromGtENUM(Materials.Naquadria); public final Material TRINIUM; public final Material TRINIUM_REFINED; //https://github.com/Blood-Asp/GT5-Unofficial/issues/609 @@ -142,6 +144,8 @@ public final class ELEMENT { public final Material POLONIUM210 = new Material("Polonium-210", MaterialState.SOLID, Materials.Plutonium241.mIconSet, POLONIUM.vDurability, POLONIUM.getRGBA(), POLONIUM.getMeltingPointK(), POLONIUM.getBoilingPointK(), 84, 126, false, StringUtils.superscript("210Po"), 2, false);//Not a GT Inherited Material public final Material AMERICIUM241 = new Material("Americium-241", MaterialState.SOLID, Materials.Americium.mIconSet, Materials.Americium.mDurability, Materials.Americium.mRGBa, Materials.Americium.mMeltingPoint, Materials.Americium.mBlastFurnaceTemp, 95, 146, false, StringUtils.superscript("241Am"), 2, false);//Not a GT Inherited Material + public final Material MAGIC = MaterialUtils.generateMaterialFromGtENUM(Materials.Magic, new short[] {10, 185, 140}); + public final Material THAUMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Thaumium); static { diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 01999ecbd4..4dd88030bd 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -255,17 +255,39 @@ public class Material { this.isRadioactive = true; this.vRadiationLevel = (byte) radiationLevel; } - else { - Logger.MATERIALS(this.getLocalizedName()+" is not radioactive."); - this.isRadioactive = false; - this.vRadiationLevel = 0; + else { + if (vMaterialInput.size() > 0) { + AutoMap<Byte> aDataSet = new AutoMap<Byte>(); + for (MaterialStack m : this.vMaterialInput) { + aDataSet.put(m.getStackMaterial().vRadiationLevel); + } + byte aAverage = MathUtils.getByteAverage(aDataSet); + if (aAverage > Byte.MAX_VALUE || aAverage < Byte.MIN_VALUE) { + aAverage = 0; + } + if (aAverage > 0) { + Logger.MATERIALS(this.getLocalizedName()+" is radioactive due to trace elements. Level: "+aAverage+"."); + this.isRadioactive = true; + this.vRadiationLevel = (byte) aAverage; + } + else { + Logger.MATERIALS(this.getLocalizedName()+" is not radioactive."); + this.isRadioactive = false; + this.vRadiationLevel = 0; + } + } + else { + Logger.MATERIALS(this.getLocalizedName()+" is not radioactive."); + this.isRadioactive = false; + this.vRadiationLevel = 0; + } } //Sets the materials 'tier'. Will probably replace this logic. this.vTier = MaterialUtils.getTierOfMaterial((int) MathUtils.celsiusToKelvin(meltingPoint)); this.usesBlastFurnace = blastFurnace; - this.vVoltageMultiplier = this.getMeltingPointK() >= 2800 ? 60 : 15; + this.vVoltageMultiplier = MaterialUtils.getVoltageForTier(vTier); this.vComponentCount = this.getComponentCount(inputs); this.vSmallestRatio = this.getSmallestRatio(this.vMaterialInput); @@ -288,11 +310,11 @@ public class Material { this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); } else if (!this.vChemicalSymbol.equals("")){ - Logger.WARNING("materialInput is null, using a valid chemical symbol."); + Logger.MATERIALS("materialInput is null, using a valid chemical symbol."); this.vChemicalFormula = this.vChemicalSymbol; } else{ - Logger.WARNING("MaterialInput == null && chemicalSymbol probably equals nothing"); + Logger.MATERIALS("MaterialInput == null && chemicalSymbol probably equals nothing"); this.vChemicalFormula = "??"; } @@ -335,13 +357,13 @@ public class Material { } } - Logger.WARNING("Creating a Material instance for "+materialName); - Logger.WARNING("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); - Logger.WARNING("Protons: "+this.vProtons); - Logger.WARNING("Neutrons: "+this.vNeutrons); - Logger.WARNING("Mass: "+this.vMass+"/units"); - Logger.WARNING("Melting Point: "+this.meltingPointC+"C."); - Logger.WARNING("Boiling Point: "+this.boilingPointC+"C."); + Logger.MATERIALS("Creating a Material instance for "+materialName); + Logger.MATERIALS("Formula: "+this.vChemicalFormula + " Smallest Stack: "+this.smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); + Logger.MATERIALS("Protons: "+this.vProtons); + Logger.MATERIALS("Neutrons: "+this.vNeutrons); + Logger.MATERIALS("Mass: "+this.vMass+"/units"); + Logger.MATERIALS("Melting Point: "+this.meltingPointC+"C."); + Logger.MATERIALS("Boiling Point: "+this.boilingPointC+"C."); } catch (Throwable t){ t.printStackTrace(); @@ -487,6 +509,10 @@ public class Material { return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingot"+this.unlocalizedName, stacksize); } + public final ItemStack getHotIngot(final int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHot"+this.unlocalizedName, stacksize); + } + public final ItemStack getPlate(final int stacksize){ return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plate"+this.unlocalizedName, stacksize); } @@ -595,21 +621,21 @@ public class Material { if (this.vMaterialInput != null && !this.vMaterialInput.isEmpty()){ final ItemStack[] temp = new ItemStack[this.vMaterialInput.size()]; for (int i=0;i<this.vMaterialInput.size();i++){ - //Utils.LOG_WARNING("i:"+i); + //Utils.LOG_MATERIALS("i:"+i); ItemStack testNull = null; try { testNull = this.vMaterialInput.get(i).getValidStack(); } catch (final Throwable r){ - Logger.WARNING("Failed gathering material stack for "+this.localizedName+"."); - Logger.WARNING("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i); + Logger.MATERIALS("Failed gathering material stack for "+this.localizedName+"."); + Logger.MATERIALS("What Failed: Length:"+this.vMaterialInput.size()+" current:"+i); } try { if (testNull != null){ - //Utils.LOG_WARNING("not null"); + //Utils.LOG_MATERIALS("not null"); temp[i] = this.vMaterialInput.get(i).getValidStack(); } } catch (final Throwable r){ - Logger.WARNING("Failed setting slot "+i+", using "+this.localizedName); + Logger.MATERIALS("Failed setting slot "+i+", using "+this.localizedName); } } return temp; @@ -659,9 +685,9 @@ public class Material { public final long[] getSmallestRatio(final ArrayList<MaterialStack> tempInput){ if (tempInput != null){ if (!tempInput.isEmpty()){ - Logger.WARNING("length: "+tempInput.size()); - Logger.WARNING("(inputs != null): "+(tempInput != null)); - //Utils.LOG_WARNING("length: "+inputs.length); + Logger.MATERIALS("length: "+tempInput.size()); + Logger.MATERIALS("(inputs != null): "+(tempInput != null)); + //Utils.LOG_MATERIALS("length: "+inputs.length); final long[] tempRatio = new long[tempInput.size()]; for (int x=0;x<tempInput.size();x++){ //tempPercentage = tempPercentage+inputs[x].percentageToUse; @@ -678,7 +704,7 @@ public class Material { for (int r=0;r<tempRatio.length;r++){ tempRatioStringThing1 = tempRatioStringThing1 + tempRatio[r] +" : "; } - Logger.WARNING("Default Ratio: "+tempRatioStringThing1); + Logger.MATERIALS("Default Ratio: "+tempRatioStringThing1); String tempRatioStringThing = ""; int tempSmallestCraftingUseSize = 0; @@ -687,7 +713,7 @@ public class Material { tempSmallestCraftingUseSize = (int) (tempSmallestCraftingUseSize + smallestRatio[r]); } //this.smallestStackSizeWhenProcessing = tempSmallestCraftingUseSize; - Logger.WARNING("Smallest Ratio: "+tempRatioStringThing); + Logger.MATERIALS("Smallest Ratio: "+tempRatioStringThing); return smallestRatio; } } @@ -699,7 +725,7 @@ public class Material { if (!aShowQuestionMarks && (this.vChemicalFormula.equals("?")||this.vChemicalFormula.equals("??"))) { return ""; } - Logger.WARNING("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); + Logger.MATERIALS("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); if (!chemSymbol.equals("")) { return chemSymbol; } @@ -742,13 +768,13 @@ public class Material { return StringUtils.subscript(dummyFormula); //return dummyFormula; } - Logger.WARNING("dummyFormulaArray <= 0"); + Logger.MATERIALS("dummyFormulaArray <= 0"); } - Logger.WARNING("dummyFormulaArray == null"); + Logger.MATERIALS("dummyFormulaArray == null"); } - Logger.WARNING("tempInput.length <= 0"); + Logger.MATERIALS("tempInput.length <= 0"); } - Logger.WARNING("tempInput == null"); + Logger.MATERIALS("tempInput == null"); return "??"; } @@ -778,33 +804,33 @@ public class Material { if (isValid != Materials._NULL){ for (Materials m : invalidMaterials.values()){ if (isValid == m){ - Logger.WARNING("Trying to generate a fluid for blacklisted material: "+m.mDefaultLocalName); + Logger.MATERIALS("Trying to generate a fluid for blacklisted material: "+m.mDefaultLocalName); FluidStack a1 = m.getFluid(1); FluidStack a2 = m.getGas(1); FluidStack a3 = m.getMolten(1); FluidStack a4 = m.getSolid(1); FluidStack a5 = m.getPlasma(1); if (a1 != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. Fluid."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. Fluid."); return a1.getFluid(); } if (a2 != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. Gas."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. Gas."); return a2.getFluid(); } if (a3 != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. Molten."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. Molten."); return a3.getFluid(); } if (a4 != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. Solid."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. Solid."); return a4.getFluid(); } if (a5 != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. Plasma."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. Plasma."); return a5.getFluid(); } - Logger.WARNING("Using null."); + Logger.MATERIALS("Using null."); return null; } } @@ -812,31 +838,31 @@ public class Material { if (this.materialState == MaterialState.SOLID){ if (isValid.mFluid != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. mFluid."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. mFluid."); return isValid.mFluid; } else if (isValid.mStandardMoltenFluid != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); return isValid.mStandardMoltenFluid; } } else if (this.materialState == MaterialState.GAS){ if (isValid.mGas != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. mGas."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. mGas."); return isValid.mGas; } } else if (this.materialState == MaterialState.LIQUID || this.materialState == MaterialState.PURE_LIQUID){ if (isValid.mFluid != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. mFluid."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. mFluid."); return isValid.mFluid; } else if (isValid.mGas != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. mGas."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. mGas."); return isValid.mGas; } else if (isValid.mStandardMoltenFluid != null){ - Logger.WARNING("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); + Logger.MATERIALS("Using a pre-defined Fluid from GT. mStandardMoltenFluid."); return isValid.mStandardMoltenFluid; } } @@ -846,28 +872,28 @@ public class Material { FluidStack aTest3 = FluidUtils.getFluidStack(Utils.sanitizeString(this.getLocalizedName()), 1); if (aTest1 != null) { - Logger.WARNING("Found FluidRegistry entry for "+"molten."+Utils.sanitizeString(this.getLocalizedName())); + Logger.MATERIALS("Found FluidRegistry entry for "+"molten."+Utils.sanitizeString(this.getLocalizedName())); return aTest1.getFluid(); } if (aTest2 != null) { - Logger.WARNING("Found FluidRegistry entry for "+"fluid."+Utils.sanitizeString(this.getLocalizedName())); + Logger.MATERIALS("Found FluidRegistry entry for "+"fluid."+Utils.sanitizeString(this.getLocalizedName())); return aTest2.getFluid(); } if (aTest3 != null) { - Logger.WARNING("Found FluidRegistry entry for "+Utils.sanitizeString(this.getLocalizedName())); + Logger.MATERIALS("Found FluidRegistry entry for "+Utils.sanitizeString(this.getLocalizedName())); return aTest3.getFluid(); } - Logger.WARNING("Generating our own fluid."); + Logger.MATERIALS("Generating our own fluid."); //Generate a Cell if we need to if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+this.getUnlocalizedName(), 1) == null){ if (this.vGenerateCells){ new BaseItemCell(this); - Logger.WARNING("Generated a cell for "+this.getUnlocalizedName()); + Logger.MATERIALS("Generated a cell for "+this.getUnlocalizedName()); } else { - Logger.WARNING("Did not generate a cell for "+this.getUnlocalizedName()); + Logger.MATERIALS("Did not generate a cell for "+this.getUnlocalizedName()); } } @@ -924,11 +950,11 @@ public class Material { } } if (isValid.mPlasma != null){ - Logger.WARNING("Using a pre-defined Plasma from GT."); + Logger.MATERIALS("Using a pre-defined Plasma from GT."); return isValid.mPlasma; } - Logger.WARNING("Generating our own Plasma."); + Logger.MATERIALS("Generating our own Plasma."); return FluidUtils.addGTPlasma(this); } @@ -950,27 +976,8 @@ public class Material { for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getMeltingPointC()); } - long aAverage = MathUtils.getAverage(aDataSet); + long aAverage = MathUtils.getLongAverage(aDataSet); return MathUtils.safeInt(aAverage); - - - - - /*int meltingPoint = 0; - for (MaterialStack part : this.vMaterialInput){ - if (part != null){ - int incrementor = part.getStackMaterial().getMeltingPointC(); - meltingPoint += incrementor; - Logger.WARNING("Melting Point for "+this.getLocalizedName()+" increased by "+ incrementor); - } - else { - Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition."); - } - } - int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1); - Logger.WARNING("Dividing "+meltingPoint+" / "+divisor+" to get average melting point."); - meltingPoint = (meltingPoint/divisor); - return meltingPoint;*/ } catch (Throwable r){ return 500; @@ -984,23 +991,8 @@ public class Material { for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getBoilingPointC()); } - long aAverage = MathUtils.getAverage(aDataSet); + long aAverage = MathUtils.getLongAverage(aDataSet); return MathUtils.safeInt(aAverage); - - - /*int boilingPoint = 0; - for (MaterialStack part : this.vMaterialInput){ - if (part != null){ - boilingPoint += part.getStackMaterial().getBoilingPointC(); - Logger.WARNING("Boiling Point for "+this.getLocalizedName()+" increased by "+ part.getStackMaterial().getBoilingPointC()); - } - else { - Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition."); - } - } - int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1); - boilingPoint = (boilingPoint/divisor); - return boilingPoint;*/ } catch (Throwable r){ return 2500; @@ -1014,21 +1006,8 @@ public class Material { for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getProtons()); } - long aAverage = MathUtils.getAverage(aDataSet); - return aAverage; - - /*long protonCount = 0; - for (MaterialStack part : this.vMaterialInput){ - if (part != null){ - protonCount += (part.getStackMaterial().getProtons()); - } - else { - Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition."); - } - } - int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1); - protonCount = (protonCount/divisor); - return protonCount;*/ + long aAverage = MathUtils.getLongAverage(aDataSet); + return MathUtils.safeInt(aAverage); } catch (Throwable r){ return 50; @@ -1042,21 +1021,8 @@ public class Material { for (MaterialStack m : this.vMaterialInput) { aDataSet.put(m.getStackMaterial().getNeutrons()); } - long aAverage = MathUtils.getAverage(aDataSet); - return aAverage; - - /*long neutronCount = 0; - for (MaterialStack part : this.vMaterialInput){ - if (part != null){ - neutronCount += (part.getStackMaterial().getNeutrons()); - } - else { - Logger.MATERIALS(this.getLocalizedName()+" has a really invalid composition."); - } - } - int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1); - neutronCount = (neutronCount/divisor); - return neutronCount;*/ + long aAverage = MathUtils.getLongAverage(aDataSet); + return MathUtils.safeInt(aAverage); } catch (Throwable r){ return 75; diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 7ec898ce3a..03146d20d3 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -357,6 +357,14 @@ public class MathUtils { } } + public static byte safeByte(long number){ + return number>Byte.MAX_VALUE ? Byte.MAX_VALUE :(byte)number; + } + + public static short safeShort(long number){ + return number>Short.MAX_VALUE ? Short.MAX_VALUE :(short)number; + } + public static int safeInt(long number, int margin){ return number>Integer.MAX_VALUE-margin ? Integer.MAX_VALUE-margin :(int)number; } @@ -376,15 +384,99 @@ public class MathUtils { } - public static long getAverage(AutoMap aDataSet) { + + /* + * Averages + */ + + public static byte getByteAverage(AutoMap<?> aDataSet) { + byte[] aNewSet = new byte[aDataSet.size()]; + for (int u=0;u<aDataSet.size();u++) { + aNewSet[u] = (byte) aDataSet.get(u); + } + return getByteAverage(aNewSet); + } + + public static short getShortAverage(AutoMap<?> aDataSet) { + short[] aNewSet = new short[aDataSet.size()]; + for (int u=0;u<aDataSet.size();u++) { + aNewSet[u] = (short) aDataSet.get(u); + } + return getShortAverage(aNewSet); + } + + public static int getIntAverage(AutoMap<?> aDataSet) { + int[] aNewSet = new int[aDataSet.size()]; + for (int u=0;u<aDataSet.size();u++) { + aNewSet[u] = (int) aDataSet.get(u); + } + return getIntAverage(aNewSet); + } + + public static float getFloatAverage(AutoMap<?> aDataSet) { + float[] aNewSet = new float[aDataSet.size()]; + for (int u=0;u<aDataSet.size();u++) { + aNewSet[u] = (float) aDataSet.get(u); + } + return getFloatAverage(aNewSet); + } + + public static long getLongAverage(AutoMap<?> aDataSet) { long[] aNewSet = new long[aDataSet.size()]; for (int u=0;u<aDataSet.size();u++) { aNewSet[u] = (long) aDataSet.get(u); } - return getAverage(aNewSet); + return getLongAverage(aNewSet); } - public static long getAverage(long[] aDataSet) { + public static double getDoubleAverage(AutoMap<?> aDataSet) { + double[] aNewSet = new double[aDataSet.size()]; + for (int u=0;u<aDataSet.size();u++) { + aNewSet[u] = (double) aDataSet.get(u); + } + return getDoubleAverage(aNewSet); + } + + + + public static byte getByteAverage(byte[] aDataSet) { + int divisor = aDataSet.length; + byte total = 0; + for (byte i : aDataSet) { + total += i; + } + byte result = safeByte(total/divisor); + return result; + } + + public static short getShortAverage(short[] aDataSet) { + int divisor = aDataSet.length; + short total = 0; + for (short i : aDataSet) { + total += i; + } + short result = safeShort(total/divisor); + return result; + } + public static int getIntAverage(int[] aDataSet) { + int divisor = aDataSet.length; + int total = 0; + for (int i : aDataSet) { + total += i; + } + int result = safeInt(total/divisor); + return result; + } + public static float getFloatAverage(float[] aDataSet) { + int divisor = aDataSet.length; + float total = 0; + for (float i : aDataSet) { + total += i; + } + float result = (total/divisor); + return result; + } + public static long getLongAverage(long[] aDataSet) { int divisor = aDataSet.length; long total = 0; for (long i : aDataSet) { @@ -393,5 +485,14 @@ public class MathUtils { long result = (total/divisor); return result; } + public static double getDoubleAverage(double[] aDataSet) { + int divisor = aDataSet.length; + double total = 0; + for (double i : aDataSet) { + total += i; + } + double result = (total/divisor); + return result; + } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java index e4f2008aac..5bdd42b02d 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/FluidUtils.java @@ -543,6 +543,44 @@ public class FluidUtils { public static FluidStack getLiquidXP(final int amount){ return EnchantingUtils.getLiquidXP(amount); } + + public static boolean doesFluidExist(String aFluidName) { + FluidStack aFStack1 = (FluidUtils.getFluidStack("molten"+"."+aFluidName.toLowerCase(), 1)); + FluidStack aFStack2 = (FluidUtils.getFluidStack("fluid"+"."+aFluidName.toLowerCase(), 1)); + FluidStack aFStack3 = (FluidUtils.getFluidStack(aFluidName.toLowerCase(), 1)); + FluidStack aFStack4 = (FluidUtils.getFluidStack(aFluidName, 1)); + FluidStack aFStack5 = (FluidUtils.getFluidStack("liquid_"+aFluidName.toLowerCase(), 1)); + FluidStack aFStack6 = (FluidUtils.getFluidStack("liquid"+"."+aFluidName.toLowerCase(), 1)); + return aFStack1 == null && aFStack2 == null && aFStack3 == null && aFStack4 == null && aFStack5 == null && aFStack6 == null; + } + + public static FluidStack getWildcardFluidStack(String aFluidName, int amount) { + FluidStack aFStack1 = (FluidUtils.getFluidStack("molten"+"."+aFluidName.toLowerCase(), 1)); + FluidStack aFStack2 = (FluidUtils.getFluidStack("fluid"+"."+aFluidName.toLowerCase(), 1)); + FluidStack aFStack3 = (FluidUtils.getFluidStack(aFluidName.toLowerCase(), 1)); + FluidStack aFStack4 = (FluidUtils.getFluidStack(aFluidName, 1)); + FluidStack aFStack5 = (FluidUtils.getFluidStack("liquid_"+aFluidName.toLowerCase(), 1)); + FluidStack aFStack6 = (FluidUtils.getFluidStack("liquid"+"."+aFluidName.toLowerCase(), 1)); + if (aFStack1 != null) { + return aFStack1; + } + if (aFStack2 != null) { + return aFStack2; + } + if (aFStack3 != null) { + return aFStack3; + } + if (aFStack4 != null) { + return aFStack4; + } + if (aFStack5 != null) { + return aFStack5; + } + if (aFStack6 != null) { + return aFStack6; + } + return null; + } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index ae43abe3c5..553f3f7efa 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -182,6 +182,42 @@ public class MaterialUtils { return 0; } } + + public static int getVoltageForTier(final int aTier) { + if (aTier == 0) { + return 16; + } + if (aTier == 1) { + return 30; + } + if (aTier == 2) { + return 120; + } + if (aTier == 3) { + return 480; + } + if (aTier == 4) { + return 1600; + } + if (aTier == 5) { + return 6400; + } + if (aTier == 6) { + return 25000; + } + if (aTier == 7) { + return 100000; + } + if (aTier == 8) { + return 400000; + } + if (aTier == 9) { + return 1600000; + } + + + return 120; + } private static Materials getMaterialByName(String materialName) { @@ -202,7 +238,10 @@ public class MaterialUtils { public static String getMaterialName(Materials mat){ String mName; try { - mName = (String) FieldUtils.getDeclaredField(Materials.class, "mName", true).get(mat); + mName = (String) FieldUtils.getDeclaredField(Materials.class, "mDefaultLocalName", true).get(mat); + if (mName == null) { + mName = (String) FieldUtils.getDeclaredField(Materials.class, "mName", true).get(mat); + } } catch (IllegalArgumentException | IllegalAccessException e) { mName = mat.name(); diff --git a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java index 884d2a47fe..d68ba3c2a6 100644 --- a/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java +++ b/src/Java/gtPlusPlus/preloader/asm/AsmConfig.java @@ -17,6 +17,7 @@ public class AsmConfig { public static boolean enableGtNbtFix; public static boolean enableChunkDebugging; public static boolean enableCofhPatch; + public static boolean enableGcFuelChanges; public AsmConfig(File file) { if (!loaded) { @@ -72,6 +73,13 @@ public class AsmConfig { enableGtTooltipFix = prop.getBoolean(true); propOrder.add(prop.getName()); + prop = config.get("general", "enableGcFuelChanges", true); + prop.comment = "Enable/Disable changes to Galacticraft Rocket Fuels."; + prop.setLanguageKey("gtpp.enableGcFuelChanges").setRequiresMcRestart(true); + enableGcFuelChanges = prop.getBoolean(true); + propOrder.add(prop.getName()); + + config.setCategoryPropertyOrder("general", propOrder); config.setCategoryPropertyOrder("debug", propOrderDebug); @@ -84,6 +92,7 @@ public class AsmConfig { FMLLog.log(Level.INFO, "[GT++ ASM] TiCon Fluid Lighting - Enabled: "+enableTiConFluidLighting, new Object[0]); FMLLog.log(Level.INFO, "[GT++ ASM] Gt Tooltip Fix - Enabled: "+enableGtTooltipFix, new Object[0]); FMLLog.log(Level.INFO, "[GT++ ASM] COFH Patch - Enabled: "+enableCofhPatch, new Object[0]); + FMLLog.log(Level.INFO, "[GT++ ASM] Gc Fuel Changes Patch - Enabled: "+enableGcFuelChanges, new Object[0]); } catch (Exception var3) { FMLLog.log(Level.ERROR, var3, "GT++ ASM had a problem loading it's config", new Object[0]); diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_NBT.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_NBT.java index b746a949f6..349bdc3e88 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_NBT.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_GT_BlockMachines_NBT.java @@ -11,7 +11,9 @@ import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.preloader.DevHelper; +import gtPlusPlus.preloader.asm.AsmConfig; public class ClassTransformer_GT_BlockMachines_NBT { @@ -27,7 +29,7 @@ public class ClassTransformer_GT_BlockMachines_NBT { String aEntityPlayerMP; String aWorld; - private static boolean doesMethodAlreadyExist = false; + public static boolean isNbtPersistencyPatchAlreadyApplied = false; public ClassTransformer_GT_BlockMachines_NBT(byte[] basicClass, boolean obfuscated) { @@ -50,16 +52,16 @@ public class ClassTransformer_GT_BlockMachines_NBT { reader = aTempReader; writer = aTempWriter; - if (reader != null && writer != null && !doesMethodAlreadyExist) { - FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Getting Valid MC Class names. "+"."); + CORE.NBT_PERSISTENCY_PATCH_APPLIED = isNbtPersistencyPatchAlreadyApplied; + + if (reader != null && writer != null && !isNbtPersistencyPatchAlreadyApplied && AsmConfig.enableGtNbtFix) { aEntityPlayer = obfuscated ? DevHelper.getObfuscated("net/minecraft/entity/player/EntityPlayer") : "net/minecraft/entity/player/EntityPlayer"; aEntityPlayerMP = obfuscated ? DevHelper.getObfuscated("net/minecraft/entity/player/EntityPlayerMP") : "net/minecraft/entity/player/EntityPlayerMP"; aWorld = obfuscated ? DevHelper.getObfuscated("net/minecraft/world/World") : "net/minecraft/world/World"; - - FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Found: "+aEntityPlayer+", "+aEntityPlayerMP+", "+aWorld+"."); FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Attempting Method Injection."); - injectMethod("removedByPlayer"); - injectMethod("harvestBlock"); + if (injectMethod("removedByPlayer") && injectMethod("harvestBlock")) { + CORE.NBT_PERSISTENCY_PATCH_APPLIED = true; + } } } @@ -76,8 +78,9 @@ public class ClassTransformer_GT_BlockMachines_NBT { return writer; } - public void injectMethod(String aMethodName) { + public boolean injectMethod(String aMethodName) { MethodVisitor mv; + boolean didInject = false; FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Injecting "+aMethodName+" into "+className+"."); if (aMethodName.equals("removedByPlayer")) { @@ -117,7 +120,7 @@ public class ClassTransformer_GT_BlockMachines_NBT { mv.visitLocalVariable("aWillHarvest", "Z", null, l0, l3, 6); mv.visitMaxs(7, 7); mv.visitEnd(); - + didInject = true; } else if (aMethodName.equals("harvestBlock")) { @@ -159,10 +162,11 @@ public class ClassTransformer_GT_BlockMachines_NBT { mv.visitLocalVariable("aMeta", "I", null, l0, l3, 6); mv.visitMaxs(7, 7); mv.visitEnd(); + didInject = true; } FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Method injection complete."); - + return didInject; } public static final class localClassVisitor extends ClassVisitor { @@ -175,11 +179,11 @@ public class ClassTransformer_GT_BlockMachines_NBT { public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { if (name.equals("removedByPlayer")) { FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Found method "+name+", skipping patch."); - doesMethodAlreadyExist = true; + isNbtPersistencyPatchAlreadyApplied = true; } if (name.equals("harvestBlock")) { FMLRelaunchLog.log("[GT++ ASM] Gregtech NBT Persistency Patch", Level.INFO, "Found method "+name+", skipping patch."); - doesMethodAlreadyExist = true; + isNbtPersistencyPatchAlreadyApplied = true; } MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); return methodVisitor; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java index 9c67f0f84f..81559db1a5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java @@ -13,6 +13,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.preloader.asm.AsmConfig; public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { @@ -27,11 +28,14 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { @Override public String[] getDescription() { String[] aTip; + + String aTankPortableness = CORE.GTNH ? "non-portable" : "portable"; + if (this.mFluid == null) { - aTip = new String[] {this.mDescription, "A portable tank.", CORE.GT_Tooltip}; + aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank.", CORE.GT_Tooltip}; } else { - aTip = new String[] {this.mDescription, "A portable tank.", "Fluid: "+mFluid.getLocalizedName()+" "+mFluid.amount+"L", CORE.GT_Tooltip}; + aTip = new String[] {this.mDescription, "A "+aTankPortableness+" tank.", "Fluid: "+mFluid.getLocalizedName()+" "+mFluid.amount+"L", CORE.GT_Tooltip}; } return aTip; } @@ -129,27 +133,28 @@ public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank { aBaseMetaTileEntity.openGUI(aPlayer); return true; } - + @Override public boolean displaysItemStack() { return true; } - + @Override public boolean displaysStackSize() { return false; } - - @Override - public void setItemNBT(NBTTagCompound aNBT) { - super.setItemNBT(aNBT); - if (mFluid != null){ - Logger.INFO("Setting item fluid nbt"); - aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); - if (aNBT.hasKey("mFluid")) { - Logger.INFO("Set mFluid to NBT."); - } - } - } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) { + if (mFluid != null){ + Logger.INFO("Setting item fluid nbt"); + aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); + if (aNBT.hasKey("mFluid")) { + Logger.INFO("Set mFluid to NBT."); + } + } + } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java index 05f25e3cf0..ac3c8727d7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelter.java @@ -78,12 +78,19 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { else { duration = (int) Math.max(M.getMass() / 50L, 1L) * 150; }*/ - + + int aSlot = M.vTier - 2; + if (aSlot < 2) { + aSlot = 2; + } + long aVoltage = GT_Values.V[aSlot >= 2 ? aSlot : 2]; + + //Set a duration - NEW - int duration = 200*M.vTier*20; + int duration = 120*M.vTier*20; if (M.vTier <= 4){ - duration = 40*M.vTier*20; + duration = 20*M.vTier*20; } int mMaterialListSize=0; @@ -123,7 +130,7 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { //Generate Recipes for all singular materials that can be made molten. if (hasMoreInputThanACircuit){ if (M.requiresBlastFurnace()) { - if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration, 240)){ + if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration, (int) aVoltage)){ Logger.WARNING("[BAS] Success."); Logger.WARNING("[BAS] Success, Also added a Fluid solidifier recipe."); if (GT_Values.RA.addFluidExtractionRecipe(M.getIngot(1), null, M.getFluid(144), 100, duration, 120)){ @@ -145,7 +152,7 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { } } else { - if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration/2, 120)){ + if (CORE.RA.addBlastSmelterRecipe(tItemStackTest, M.getFluid(fluidAmount), 100, duration/2, (int) aVoltage)){ Logger.WARNING("[BAS] Success."); if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), M.getFluid(144), M.getIngot(1), duration/2, 60)){ Logger.WARNING("[BAS] Success, Also added a Fluid solidifier recipe."); @@ -246,7 +253,7 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { //Adds Recipe if (M.requiresBlastFurnace()) { - if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 500)){ + if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, (int) aVoltage)){ Logger.WARNING("[BAS] Success."); } else { @@ -254,7 +261,7 @@ public class RecipeGen_BlastSmelter extends RecipeGen_Base { } } else { - if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, 240)){ + if (CORE.RA.addBlastSmelterRecipe(components, componentsFluid, M.getFluid(fluidAmount), 100, duration, (int) aVoltage/2)){ Logger.WARNING("[BAS] Success."); } else { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index 49407f843c..f78f81f82c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -244,20 +244,23 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { input4 = (inputStacks.length >= 4) ? (input4 = (inputStacks[3] == null) ? null : inputStacks[3]) : null; if (inputStacks.length == 1) { - input2 = CI.getNumberedCircuit(20); + input2 = input1; + input1 = CI.getNumberedCircuit(20); } else if (inputStacks.length == 2) { - input3 = CI.getNumberedCircuit(20); + input3 = input2; + input2 = input1; + input1 = CI.getNumberedCircuit(20); } else if (inputStacks.length == 3) { - input4 = CI.getNumberedCircuit(20); - + input4 = input3; + input3 = input2; + input2 = input1; + input1 = CI.getNumberedCircuit(20); } - - + //Add mixer Recipe - FluidStack oxygen = GT_Values.NF; if (material.getComposites() != null){ int compSlot = 0; diff --git a/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java b/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java new file mode 100644 index 0000000000..b28ccdaa9b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/witchery/WitchUtils.java @@ -0,0 +1,89 @@ +package gtPlusPlus.xmod.witchery; + +import java.lang.reflect.Field; +import java.util.ArrayList; + +import com.emoniph.witchery.Witchery; +import com.emoniph.witchery.entity.ai.EntityAIDigBlocks; +import com.mojang.authlib.GameProfile; + +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; +import net.minecraftforge.event.world.BlockEvent; +import net.minecraftforge.oredict.OreDictionary; + +public class WitchUtils { + + private static final Field KOBOLDITE_MINER_PROFILE; + + static { + if (LoadedMods.Witchery) { + KOBOLDITE_MINER_PROFILE = getField("com.emoniph.witchery.entity.ai.EntityAIDigBlocks", "KOBOLDITE_MINER_PROFILE"); + } + else { + KOBOLDITE_MINER_PROFILE = null; + } + + } + + //com.emoniph.witchery.entity.ai.EntityAIDigBlocks.onHarvestDrops(EntityPlayer, HarvestDropsEvent) + public static void onHarvestDrops(final EntityPlayer harvester, final BlockEvent.HarvestDropsEvent event) { + if (harvester != null && !harvester.worldObj.isRemote && !event.isCanceled() && (isEqual(harvester.getGameProfile(), EntityAIDigBlocks.KOBOLDITE_MINER_PROFILE) || isEqual(harvester.getGameProfile(), EntityAIDigBlocks.NORMAL_MINER_PROFILE))) { + final boolean hasKobolditePick = isEqual(harvester.getGameProfile(), EntityAIDigBlocks.KOBOLDITE_MINER_PROFILE); + final ArrayList<ItemStack> newDrops = new ArrayList<ItemStack>(); + double kobolditeChance = hasKobolditePick ? 0.02 : 0.01; + for (final ItemStack drop : event.drops) { + final int[] oreIDs = OreDictionary.getOreIDs(drop); + boolean addOriginal = true; + if (oreIDs.length > 0) { + final String oreName = OreDictionary.getOreName(oreIDs[0]); + if (oreName != null && oreName.startsWith("ore")) { + final ItemStack smeltedDrop = FurnaceRecipes.smelting().getSmeltingResult(drop); + if (smeltedDrop != null && hasKobolditePick && harvester.worldObj.rand.nextDouble() < 0.5) { + addOriginal = false; + newDrops.add(smeltedDrop.copy()); + newDrops.add(smeltedDrop.copy()); + if (harvester.worldObj.rand.nextDouble() < 0.25) { + newDrops.add(smeltedDrop.copy()); + } + } + kobolditeChance = (hasKobolditePick ? 0.08 : 0.05); + } + } + if (addOriginal) { + newDrops.add(drop); + } + } + event.drops.clear(); + for (final ItemStack newDrop : newDrops) { + event.drops.add(newDrop); + } + if (kobolditeChance > 0.0 && harvester.worldObj.rand.nextDouble() < kobolditeChance) { + event.drops.add(Witchery.Items.GENERIC.itemKobolditeDust.createStack()); + } + } + } + + public static Field getField(String aClassName, String aFieldName) { + Class c; + try { + c = Class.forName(aClassName); + if (c != null) { + Field f = ReflectionUtils.getField(c, aFieldName); + if (f != null) { + return f; + } + } + } catch (ClassNotFoundException | NoSuchFieldException e) { + } + return null; + } + + public static boolean isEqual(final GameProfile a, final GameProfile b) { + return a != null && b != null && a.getId() != null && b.getId() != null && a.getId().equals(b.getId()); + } + +} |