diff options
author | Alkalus <Draknyte1@hotmail.com> | 2020-03-31 16:35:15 +0100 |
---|---|---|
committer | Alkalus <Draknyte1@hotmail.com> | 2020-03-31 16:35:15 +0100 |
commit | 2c4a94b808c61d66163d9969017c2819ddb2c5ae (patch) | |
tree | 3af0f3ca11bb52b3183ef100e4dc6892a76f83e7 | |
parent | 09b08b073aea41bfbdf189c88cc722912952ea6d (diff) | |
download | GT5-Unofficial-2c4a94b808c61d66163d9969017c2819ddb2c5ae.tar.gz GT5-Unofficial-2c4a94b808c61d66163d9969017c2819ddb2c5ae.tar.bz2 GT5-Unofficial-2c4a94b808c61d66163d9969017c2819ddb2c5ae.zip |
+ Added a Pine Tree.
+ Oredict BoP Pinecone if it exists.
$ Fixed Algae Farm controller recipe.
$ Fixed bug where getOrePrefixStack(rod) would return null.
$ Fixed a bug where getItemStackFromFQRN didn't work correctly.
19 files changed, 688 insertions, 34 deletions
diff --git a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java index a9bd1568b6..c9cdc41424 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java +++ b/src/Java/gtPlusPlus/core/commands/CommandEnableDebugWhileRunning.java @@ -126,9 +126,9 @@ public class CommandEnableDebugWhileRunning implements ICommand String aOreDictData = ""; if (!aOreDictNames.isEmpty()) { for (String tag : aOreDictNames) { - aOreDictData += (tag+","); + aOreDictData += (tag+", "); } - if (aOreDictData.endsWith(",")) { + if (aOreDictData.endsWith(", ")) { aOreDictData = aOreDictData.substring(0, aOreDictData.length()-2); } } @@ -167,6 +167,18 @@ public class CommandEnableDebugWhileRunning implements ICommand } } } + else if (argString[0].toLowerCase().equals("item")) { + if (argString.length > 1 && argString[1] != null && argString[1].length() > 0) { + final EntityPlayer P = CommandUtils.getPlayer(S); + ItemStack aTest = ItemUtils.getItemStackFromFQRN(argString[1], 1); + if (P != null && aTest != null) { + PlayerUtils.messagePlayer(P, "Found fluid stack: "+ItemUtils.getItemName(aTest)); + } + else if (P != null && aTest == null) { + PlayerUtils.messagePlayer(P, "Could not find valid item."); + } + } + } else { final EntityPlayer P = CommandUtils.getPlayer(S); PlayerUtils.messagePlayer(P, "Invalid command, use '?' as an argument for help.'"); @@ -217,9 +229,9 @@ public class CommandEnableDebugWhileRunning implements ICommand int a = 0; String data = ""; for (String tag : aItemDataTags) { - data += (tag+","); + data += (tag+", "); } - if (data.endsWith(",")) { + if (data.endsWith(", ")) { data = data.substring(0, data.length()-2); } return data; diff --git a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java index 3f02ca898d..e11b163753 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java @@ -110,6 +110,7 @@ public class AgriculturalChem extends ItemPackage { * 21 - Lithium Chloride * 22 - Pellet Mold * 23 - Clean Aluminium Mix + * 24 - Pinecone */ public static ItemStack mAlgaeBiosmass; @@ -136,6 +137,8 @@ public class AgriculturalChem extends ItemPackage { public static ItemStack mLithiumChloride; public static ItemStack mPelletMold; public static ItemStack mCleanAluminiumMix; + public static ItemStack mPinecone; + public static ItemStack mCrushedPine; @Override @@ -205,6 +208,8 @@ public class AgriculturalChem extends ItemPackage { mLithiumChloride = ItemUtils.simpleMetaStack(mAgrichemItem1, 21, 1); mPelletMold = ItemUtils.simpleMetaStack(mAgrichemItem1, 22, 1); mCleanAluminiumMix = ItemUtils.simpleMetaStack(mAgrichemItem1, 23, 1); + mPinecone = ItemUtils.simpleMetaStack(mAgrichemItem1, 24, 1); + mCrushedPine = ItemUtils.simpleMetaStack(mAgrichemItem1, 25, 1); ItemUtils.addItemToOreDictionary(mGreenAlgaeBiosmass, "biomassGreenAlgae"); ItemUtils.addItemToOreDictionary(mBrownAlgaeBiosmass, "biomassBrownAlgae"); @@ -231,6 +236,8 @@ public class AgriculturalChem extends ItemPackage { ItemUtils.addItemToOreDictionary(mSodiumHydroxide, "dustSodiumHydroxide"); ItemUtils.addItemToOreDictionary(mSodiumCarbonate, "dustSodiumCarbonate"); ItemUtils.addItemToOreDictionary(mLithiumChloride, "dustLithiumChloride"); + ItemUtils.addItemToOreDictionary(mPinecone, "pinecone"); + ItemUtils.addItemToOreDictionary(mCrushedPine, "crushedPineMaterial"); //Handle GT NaOH dusts List<ItemStack> NaOHSmall = OreDictionary.getOres("dustSmallSodiumHydroxide_GT5U", false); diff --git a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java index 426f48ecf9..86ffe49eed 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java @@ -1,46 +1,61 @@ package gtPlusPlus.core.item.chemistry; +import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.ItemPackage; import gtPlusPlus.core.item.base.ore.BaseItemMilledOre; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.minecraft.NBTUtils; +import gtPlusPlus.xmod.bop.HANDLER_BiomesOPlenty; +import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; public class MilledOreProcessing extends ItemPackage { /** * Fluids */ - + public static Fluid ZincFlotationFroth; public static Fluid CopperFlotationFroth; public static Fluid NickelFlotationFroth; public static Fluid PlatinumFlotationFroth; public static Fluid PentlanditeFlotationFroth; - - + + public static Fluid PineOil; + + /** * Items */ // Zinc, Iron, Indium, Germanium public static Item milledSphalerite; - + // Copper, Iron, Cadmium, Indium public static Item milledChalcopyrite; - + // Nickel, Cobalt, Rhodium, Ruthenium public static Item milledNickel; - + // Platinum, Rhodium, Selenium, Tellurium public static Item milledPlatinum; // Iron, Nickel, Promethium, Hafnium public static Item milledPentlandite; - + @Override public void items() { @@ -50,7 +65,7 @@ public class MilledOreProcessing extends ItemPackage { milledNickel = BaseItemMilledOre.generate(Materials.Nickel, MaterialUtils.getVoltageForTier(4)); milledPlatinum = BaseItemMilledOre.generate(Materials.Platinum, MaterialUtils.getVoltageForTier(5)); milledPentlandite = BaseItemMilledOre.generate(Materials.Pentlandite, MaterialUtils.getVoltageForTier(5)); - + } @Override @@ -60,7 +75,7 @@ public class MilledOreProcessing extends ItemPackage { @Override public void fluids() { - + short[] aZincFrothRGB = Materials.Sphalerite.mRGBa; ZincFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.zincflotation", "Zinc Froth", 32 + 175, new short[] { aZincFrothRGB[0], aZincFrothRGB[1], aZincFrothRGB[2], 100 }, true); short[] aCopperFrothRGB = Materials.Chalcopyrite.mRGBa; @@ -72,9 +87,11 @@ public class MilledOreProcessing extends ItemPackage { short[] aPentlanditeFrothRGB = Materials.Pentlandite.mRGBa; PentlanditeFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.pentlanditeflotation", "Pentlandite Froth", 32 + 175, new short[] { aPentlanditeFrothRGB[0], aPentlanditeFrothRGB[1], aPentlanditeFrothRGB[2], 100 }, true); + PineOil = FluidUtils.generateFluidNoPrefix("pineoil", "Pine Oil", 32 + 175, new short[] { 250, 200, 60, 100 }, true); + } - - + + public MilledOreProcessing() { super(); @@ -98,6 +115,7 @@ public class MilledOreProcessing extends ItemPackage { 30 * 20, 30);*/ + } @Override @@ -108,6 +126,150 @@ public class MilledOreProcessing extends ItemPackage { @Override public boolean generateRecipes() { addMiscRecipes(); + addPineOilExtraction(); return true; } + + private void addPineOilExtraction() { + AutoMap<ItemStack> aLogs = new AutoMap<ItemStack>(); + AutoMap<ItemStack> aLeaves = new AutoMap<ItemStack>(); + AutoMap<ItemStack> aSaplings = new AutoMap<ItemStack>(); + AutoMap<ItemStack> aPinecones = new AutoMap<ItemStack>(); + + ItemStack aCrushedPine = ItemUtils.getSimpleStack(AgriculturalChem.mCrushedPine, 1); + + aLogs.add(ItemUtils.getSimpleStack(BOP_Block_Registrator.log_Pine)); + aLeaves.add(ItemUtils.getSimpleStack(BOP_Block_Registrator.leaves_Pine)); + aSaplings.add(ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Pine)); + aPinecones.add(ItemUtils.getSimpleStack(AgriculturalChem.mPinecone, 1)); + + if (LoadedMods.BiomesOPlenty) { + aLogs.add(HANDLER_BiomesOPlenty.getStack(HANDLER_BiomesOPlenty.logs4, 0, 1)); + aLeaves.add(HANDLER_BiomesOPlenty.getStack(HANDLER_BiomesOPlenty.colorizedLeaves2, 1, 1)); + aSaplings.add(HANDLER_BiomesOPlenty.getStack(HANDLER_BiomesOPlenty.colorizedSaplings, 5, 1)); + aPinecones.add(ItemUtils.simpleMetaStack(HANDLER_BiomesOPlenty.mPineCone, 13, 1)); + } + if (LoadedMods.Forestry) { + ItemStack aForestryLog = ItemUtils.getItemStackFromFQRN("Forestry:logs", 1); + if (aForestryLog != null) { + aForestryLog.setItemDamage(20); // Set to Pine + aLogs.add(aForestryLog); + } + ItemStack aForestryLeaves = ItemUtils.getItemStackFromFQRN("Forestry:leaves", 1); + if (aForestryLeaves != null) { + NBTUtils.setString(aForestryLeaves, "species", "forestry.treePine"); // Set to Pine + aLeaves.add(aForestryLeaves); + } + } + + for (ItemStack aLog : aLogs) { + addRecipe(aLog, ItemUtils.getSimpleStack(aCrushedPine, 16), new int[] {10000, 7500, 5000, 2500}, 10, 120); + } + for (ItemStack aLeaf : aLeaves) { + addRecipe(aLeaf, ItemUtils.getSimpleStack(aCrushedPine, 2), new int[] {5000, 5000, 2500, 2500}, 10, 30); + } + for (ItemStack aSapling : aSaplings) { + addRecipe(aSapling, ItemUtils.getSimpleStack(aCrushedPine, 4), new int[] {7500, 7500, 2500, 2500}, 10, 60); + } + for (ItemStack aCone : aPinecones) { + addRecipe(aCone, ItemUtils.getSimpleStack(aCrushedPine, 1), new int[] {7500, 7500, 5000, 2500}, 10, 60); + } + + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(16), + ItemUtils.getSimpleStack(aCrushedPine, 64) + }, + new FluidStack[] { + FluidUtils.getSteam(5000), + }, + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5) + }, + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 1000) + }, + new int[] { + 2000, 2000, 2000, 2000 + }, + 20 *60, + 120, + 2); + + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(18), + ItemUtils.getSimpleStack(aCrushedPine, 64) + }, + new FluidStack[] { + FluidUtils.getSuperHeatedSteam(5000), + }, + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5), + ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5) + }, + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 2000) + }, + new int[] { + 3000, 3000, 3000, 3000 + }, + 20 *60, + 120, + 3); + + } + + public boolean addRecipe(ItemStack aInput, ItemStack aOutput1, int[] aChances, int aTime, int aEU) { + aOutput1 = GT_OreDictUnificator.get(true, aOutput1); + ItemStack aOutputs[] = new ItemStack[4]; + for (int i=0;i<aChances.length;i++) { + aOutputs[i] = aOutput1; + } + aOutputs = cleanArray(aOutputs); + if ((GT_Utility.isStackInvalid(aInput)) || (GT_Utility.isStackInvalid(aOutput1) || (GT_Utility.getContainerItem(aInput, false) != null))) { + return false; + } + + return CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(14), + aInput + }, + new FluidStack[] { + + }, + aOutputs, + new FluidStack[] { + + }, + aChances, + aTime * 20, + aEU, + 1); + } + + public static ItemStack[] cleanArray(ItemStack[] input) { + int aArraySize = input.length; + AutoMap<ItemStack> aCleanedItems = new AutoMap<ItemStack>(); + for (ItemStack checkStack : input) { + if (ItemUtils.checkForInvalidItems(checkStack)) { + aCleanedItems.put(checkStack); + } + } + ItemStack[] aOutput = new ItemStack[aCleanedItems.size()]; + for (int i=0;i<aArraySize;i++) { + ItemStack aMappedStack = aCleanedItems.get(i); + if (aMappedStack != null){ + aOutput[i] = aMappedStack; + } + } + return aOutput; + } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index 725799a43d..3e536ec8d0 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -292,7 +292,20 @@ public class ItemUtils { public static ItemStack getItemStackFromFQRN(final String fqrn, final int Size) // fqrn = fully qualified resource name { final String[] fqrnSplit = fqrn.split(":"); - return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); + if (fqrnSplit.length < 2) { + return null; + } + else if (fqrnSplit.length == 2) { + return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); + } + else { + if (fqrnSplit.length == 3) { + ItemStack aStack = GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); + int aMeta = Integer.getInteger(fqrnSplit[2]); + return ItemUtils.simpleMetaStack(aStack, aMeta, Size); + } + } + return null; } public static void generateSpawnEgg(final String entityModID, final String parSpawnName, final int colourEgg, @@ -871,6 +884,9 @@ public class ItemUtils { } public static ItemStack getOrePrefixStack(OrePrefixes mPrefix, Materials mMat, int mAmount) { + if (mPrefix == OrePrefixes.rod) { + mPrefix = OrePrefixes.stick; + } ItemStack aGtStack = GT_OreDictUnificator.get(mPrefix, mMat, mAmount); if (aGtStack == null) { Logger.INFO( diff --git a/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java index 201da99488..48aae5521a 100644 --- a/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java +++ b/src/Java/gtPlusPlus/plugin/agrichem/item/algae/ItemAgrichemBase.java @@ -50,6 +50,8 @@ public class ItemAgrichemBase extends Item { * 21 - Lithium Chloride * 22 - Pellet Mold * 23 - Clean Aluminium Mix + * 24 - Pinecone + * 25 - Crushed Pine */ public ItemAgrichemBase() { @@ -57,7 +59,7 @@ public class ItemAgrichemBase extends Item { this.setNoRepair(); this.setMaxStackSize(64); this.setMaxDamage(0); - base = new IIcon[24]; + base = new IIcon[26]; this.setUnlocalizedName("BasicAgrichemItem"); GameRegistry.registerItem(this, this.getUnlocalizedName()); } diff --git a/src/Java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java b/src/Java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java index 9d646e3eb5..95067300c8 100644 --- a/src/Java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java +++ b/src/Java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java @@ -1,16 +1,42 @@ package gtPlusPlus.xmod.bop; +import java.lang.reflect.Field; + import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; public class HANDLER_BiomesOPlenty { + + public static Item mPineCone; + + public static Block logs1; + public static Block logs2; + public static Block logs3; + public static Block logs4; + + public static Block leaves1; + public static Block leaves2; + public static Block leaves3; + public static Block leaves4; + public static Block colorizedLeaves1; + public static Block colorizedLeaves2; + public static Block saplings; + public static Block colorizedSaplings; + public static void preInit(){ - //if (LoadedMods.BiomesOPlenty){ - BOP_Block_Registrator.run(); - //} + BOP_Block_Registrator.run(); + if (LoadedMods.BiomesOPlenty){ + setFields(); + registerPineconeToOreDict(); + } } @@ -21,11 +47,135 @@ public class HANDLER_BiomesOPlenty { } public static void postInit(){ + BOP_Block_Registrator.recipes(); if (LoadedMods.BiomesOPlenty){ - BOP_Block_Registrator.recipes(); + } + } + private static void registerPineconeToOreDict() { + if (mPineCone != null) { + ItemStack aPinecone = ItemUtils.simpleMetaStack(mPineCone, 13, 1); + if (aPinecone != null) { + ItemUtils.addItemToOreDictionary(aPinecone, "pinecone"); + } + } + } + + public static ItemStack getStack(Block aBlock, int aMeta, int aSize) { + return ItemUtils.simpleMetaStack(aBlock, aMeta, aSize); } + + //BOPCBlocks.logs4 - 0 + //BOPCBlocks.colorizedLeaves2 - 1 + + private static void setFields() { + Field aBopMiscItem = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCItems"), "misc"); + + Field aBopBlock1 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs1"); + Field aBopBlock2 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs2"); + Field aBopBlock3 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs3"); + Field aBopBlock4 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "logs4"); + + Field aBopLeaves1 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves1"); + Field aBopLeaves2 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves2"); + Field aBopLeaves3 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves3"); + Field aBopLeaves4 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "leaves4"); + + Field aBopColouredLeaves1 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedLeaves1"); + Field aBopColouredLeaves2 = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedLeaves2"); + + Field aBopSapling = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "saplings"); + Field aBopColouredSapling = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedSaplings"); + + if (aBopMiscItem != null) { + Item aMiscItem = (Item) ReflectionUtils.getFieldValue(aBopMiscItem); + if (aMiscItem != null) { + mPineCone = aMiscItem; + } + } + + + if (aBopBlock1 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock1); + if (aBlock != null) { + logs1 = aBlock; + } + } + if (aBopBlock2 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock2); + if (aBlock != null) { + logs2 = aBlock; + } + } + if (aBopBlock3 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock3); + if (aBlock != null) { + logs3 = aBlock; + } + } + if (aBopBlock4 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock4); + if (aBlock != null) { + logs4 = aBlock; + } + } + + + if (aBopLeaves1 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves1); + if (aBlock != null) { + leaves1 = aBlock; + } + } + if (aBopLeaves2 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves2); + if (aBlock != null) { + leaves2 = aBlock; + } + } + if (aBopLeaves3 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves3); + if (aBlock != null) { + leaves3 = aBlock; + } + } + if (aBopLeaves4 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves4); + if (aBlock != null) { + leaves4 = aBlock; + } + } + + + if (aBopColouredLeaves1 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredLeaves1); + if (aBlock != null) { + colorizedLeaves1 = aBlock; + } + } + if (aBopColouredLeaves2 != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredLeaves2); + if (aBlock != null) { + colorizedLeaves2 = aBlock; + } + } + + + if (aBopSapling != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopSapling); + if (aBlock != null) { + saplings = aBlock; + } + } + if (aBopColouredSapling != null) { + Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredSapling); + if (aBlock != null) { + colorizedSaplings = aBlock; + } + } + } + } diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java b/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java index 2ee1587809..3716359d7a 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/BOP_Block_Registrator.java @@ -16,6 +16,9 @@ import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; +import gtPlusPlus.xmod.bop.blocks.pine.LeavesPineTree; +import gtPlusPlus.xmod.bop.blocks.pine.LogPineTree; +import gtPlusPlus.xmod.bop.blocks.pine.SaplingPineTree; import gtPlusPlus.xmod.bop.blocks.rainforest.LeavesRainforestTree; import gtPlusPlus.xmod.bop.blocks.rainforest.LogRainforestTree; import gtPlusPlus.xmod.bop.blocks.rainforest.SaplingRainforestTree; @@ -30,10 +33,14 @@ public class BOP_Block_Registrator { public static Block log_Rainforest; public static Block leaves_Rainforest; public static Block sapling_Rainforest; + public static Block log_Pine; + public static Block leaves_Pine; + public static Block sapling_Pine; //Runs Each tree Type separately public static final void run(){ registerTree_Rainforest(); + registerTree_Pine(); } @@ -47,10 +54,23 @@ public class BOP_Block_Registrator { return true; } + private static final boolean registerTree_Pine(){ + log_Pine = new LogPineTree(); + leaves_Pine = new LeavesPineTree(); + sapling_Pine = new SaplingPineTree(); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(log_Pine), "logWood", true); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(leaves_Pine), "treeLeaves", true); + ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(sapling_Pine), "treeSapling", true); + return true; + } + public static final void recipes() { - //Rainforest Oak + // Rainforest Oak addLogRecipes(ItemUtils.getSimpleStack(log_Rainforest)); addSaplingRecipes(ItemUtils.getSimpleStack(sapling_Rainforest)); + // Pine + addLogRecipes(ItemUtils.getSimpleStack(log_Pine)); + addSaplingRecipes(ItemUtils.getSimpleStack(sapling_Pine)); } diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java index 264aaa2a20..5c86c45591 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java @@ -55,16 +55,12 @@ public class LeavesBase extends BlockLeaves { @Override//Drops when Leaf is broken protected void func_150124_c(World world, int x, int y, int z, int meta, int randomChance){ - if (this.treeType.length == this.bonusDrops.length){ - for (int i = 0; i < this.treeType.length; ++i){ - if (this.bonusDrops[i] != null && world.rand.nextInt(randomChance) == 0){ - this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(this.bonusDrops[i], 1)); - } + Logger.INFO("Dropping Bonus Drops"); + for (int i = 0; i < this.bonusDrops.length; ++i){ + if (this.bonusDrops[i] != null && world.rand.nextInt(randomChance) == 0){ + this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(this.bonusDrops[i], 1)); } } - else { - Logger.WARNING("Unable to drop anything, Leaf Type array and Loot array are different sizes."); - } } /** diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java b/src/Java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java new file mode 100644 index 0000000000..c942db14cf --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/pine/LeavesPineTree.java @@ -0,0 +1,36 @@ +package gtPlusPlus.xmod.bop.blocks.pine; + +import java.util.Random; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.item.chemistry.AgriculturalChem; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; +import gtPlusPlus.xmod.bop.blocks.base.LeavesBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class LeavesPineTree extends LeavesBase { + + public LeavesPineTree(){ + super("Pine", "pine", new ItemStack[]{}); + this.treeType = new String[] {"pine"}; + this.leafType = new String[][] {{"pine"},{"pine_opaque"}}; + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_){ + return Item.getItemFromBlock(BOP_Block_Registrator.sapling_Pine); + } + + @Override//Drops when Leaf is broken + protected void func_150124_c(World world, int x, int y, int z, int meta, int randomChance){ + Logger.INFO("Dropping Bonus Drops"); + if (MathUtils.randInt(0, 10) >= 9) { + this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(AgriculturalChem.mPinecone, MathUtils.randInt(1, 4))); + } + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java b/src/Java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java new file mode 100644 index 0000000000..dee5bf02fd --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/pine/LogPineTree.java @@ -0,0 +1,24 @@ +package gtPlusPlus.xmod.bop.blocks.pine; + +import gtPlusPlus.xmod.bop.blocks.base.LogBase; + +public class LogPineTree extends LogBase { + + public LogPineTree(){ + super("Pine Log", "pine", new String[]{"pine"}); + this.treeType = new String[] {"pine"}; + } + + /*@Override + @SideOnly(Side.CLIENT) + protected IIcon getSideIcon(int metaID){ + return this.textureSide[metaID % this.textureSide.length]; + } + + @Override + @SideOnly(Side.CLIENT) + protected IIcon getTopIcon(int metaID){ + return this.textureTop[metaID % this.textureTop.length]; + }*/ + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java b/src/Java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java new file mode 100644 index 0000000000..0ee04de899 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/pine/SaplingPineTree.java @@ -0,0 +1,55 @@ +package gtPlusPlus.xmod.bop.blocks.pine; + +import java.util.Random; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.bop.blocks.base.SaplingBase; +import gtPlusPlus.xmod.bop.world.features.trees.WorldGenPineTree; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenBigTree; +import net.minecraft.world.gen.feature.WorldGenTrees; +import net.minecraft.world.gen.feature.WorldGenerator; + +public class SaplingPineTree extends SaplingBase { + + public SaplingPineTree(){ + super("Pine Sapling", "pine", new String[]{"pine"}); + } + + @Override + public void func_149878_d(World world, int x, int y, int z, Random rand){ + Logger.WARNING("func_149878_d - 1"); + if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return; + rand.nextInt(10); + new WorldGenBigTree(true); + new WorldGenTrees(true); + int i1 = 0; + int j1 = 0; + boolean flag = false; + + Block block = Blocks.air; + + if (flag) + { + world.setBlock(x + i1, y, z + j1, block, 0, 4); + world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4); + world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4); + world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4); + } + else + { + world.setBlock(x, y, z, block, 0, 4); + } + Object obj = new WorldGenPineTree(); + if (obj != null) { + world.setBlockToAir(x, y, z); + if (!((WorldGenerator) obj).generate(world, CORE.RANDOM, x, y, z)) { + world.setBlock(x, y, z, this, 0, 2); + } + } + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/bop/world/features/trees/WorldGenPineTree.java b/src/Java/gtPlusPlus/xmod/bop/world/features/trees/WorldGenPineTree.java new file mode 100644 index 0000000000..831108ec99 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/bop/world/features/trees/WorldGenPineTree.java @@ -0,0 +1,171 @@ +package gtPlusPlus.xmod.bop.world.features.trees; + +import java.util.Random; + +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; +import net.minecraft.block.Block; +import net.minecraft.block.BlockSapling; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraftforge.common.util.ForgeDirection; + +public class WorldGenPineTree extends WorldGenAbstractTree{ + + public WorldGenPineTree() { + super(true); + } + + @Override + public boolean generate(World world, Random random, int x, int y, int z) { + while (world.isAirBlock(x, y, z) && y > 2) { + --y; + } + + Block aSoilBlock = world.getBlock(x, y, z); + + if (!canBlockSustainSapling(world, aSoilBlock, x, y, z)) { + return false; + } else { + int height; + int branches; + for (height = -2; height <= 2; ++height) { + for (branches = -2; branches <= 2; ++branches) { + if (world.isAirBlock(x + height, y - 1, z + branches) + && world.isAirBlock(x + height, y - 2, z + branches) + && !world.isAirBlock(x + height, y, z + branches)) { + return false; + } + } + } + + height = 2 + MathUtils.randInt(8, 16); + branches = 2 + MathUtils.randInt(6, 18); + int h = 1; + aSoilBlock.onPlantGrow(world, x, y - 1, z, x, y, z); + + int c; + int r = MathUtils.randInt(1, 3); + for (c = 0; c < height; ++c) { + this.buildBlock(world, x, y + h, z, BOP_Block_Registrator.log_Pine, 0); + h++; + if (c >= r && c % 2 == 0) { + this.generateBranch(world, random, x, y + h, z, c); + } + } + + this.generateTop(world, x, y + h, z); + return true; + } + } + + public void generateTop(World world, int x, int y, int z) { + for (int i = -1; i < 2; ++i) { + for (int j = -1; j < 2; ++j) { + this.buildBlock(world, x + i, y, z + j, BOP_Block_Registrator.leaves_Pine, 0); + } + } + + this.buildBlock(world, x, y, z, BOP_Block_Registrator.log_Pine, 0); + this.buildBlock(world, x + 1, y + 1, z, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x, y + 1, z - 1, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x, y + 1, z + 1, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x - 1, y + 1, z, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x, y + 2, z, BOP_Block_Registrator.leaves_Pine, 0); + } + + public void generateBranch(World world, Random rand, int x, int y, int z, int n) { + int var99999; + int var99998; + for (var99999 = -1; var99999 < 2; ++var99999) { + for (var99998 = -1; var99998 < 2; ++var99998) { + this.buildBlock(world, x + var99999, y, z + var99998, BOP_Block_Registrator.leaves_Pine, 0); + } + } + + var99999 = rand.nextInt(2); + var99998 = rand.nextInt(2); + int var99997 = rand.nextInt(2); + int var99996 = rand.nextInt(2); + if (n % 2 == 0) { + if (var99998 == 0) { + this.buildBlock(world, x + 1, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x + 2, y - 1, z - 1, BOP_Block_Registrator.leaves_Pine, 0); + if (var99999 == 0) { + this.buildBlock(world, x + 2, y - 2, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + } else { + this.buildBlock(world, x + 2, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + } + } else { + this.buildBlock(world, x + 1, y, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x + 2, y, z - 1, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x + 2, y, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + } + + if (var99997 == 0) { + this.buildBlock(world, x - 2, y - 1, z + 1, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x - 1, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + if (var99996 == 0) { + this.buildBlock(world, x - 2, y - 2, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + } else { + this.buildBlock(world, x - 2, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + } + } else { + this.buildBlock(world, x - 2, y, z + 1, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x - 1, y, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x - 2, y, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + } + } else { + if (var99998 == 0) { + this.buildBlock(world, x + 2, y - 1, z + 1, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x + 1, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + if (var99999 == 0) { + this.buildBlock(world, x + 2, y - 2, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + } else { + this.buildBlock(world, x + 2, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + } + } else { + this.buildBlock(world, x + 2, y, z + 1, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x + 1, y, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + if (var99999 == 0) { + this.buildBlock(world, x + 2, y - 1, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + } else { + this.buildBlock(world, x + 2, y, z + 2, BOP_Block_Registrator.leaves_Pine, 0); + } + } + + if (var99997 == 0) { + this.buildBlock(world, x - 1, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x - 2, y - 1, z - 1, BOP_Block_Registrator.leaves_Pine, 0); + if (var99996 == 0) { + this.buildBlock(world, x - 2, y - 2, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + } else { + this.buildBlock(world, x - 2, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + } + } else { + this.buildBlock(world, x - 1, y, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + this.buildBlock(world, x - 2, y, z - 1, BOP_Block_Registrator.leaves_Pine, 0); + if (var99996 == 0) { + this.buildBlock(world, x - 2, y - 1, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + } else { + this.buildBlock(world, x - 2, y, z - 2, BOP_Block_Registrator.leaves_Pine, 0); + } + } + } + + this.buildBlock(world, x, y, z, BOP_Block_Registrator.log_Pine, 0); + this.buildBlock(world, x, y + 1, z, BOP_Block_Registrator.log_Pine, 0); + } + + public void buildBlock(World world, int x, int y, int z, Block block, int meta) { + if (world.isAirBlock(x, y, z) || world.getBlock(x, y, z).isLeaves(world, x, y, z)) { + world.setBlock(x, y, z, block, meta, 2); + } + } + + public boolean canBlockSustainSapling(World world, Block block, int x, int y, int z) { + return block.canSustainPlant(world, x, y, z, ForgeDirection.UP, (BlockSapling)Blocks.sapling); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index d4a25e03dd..da93fe212c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -46,9 +46,8 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { } private void generateRecipes(final Material material, final boolean disableOptional){ - final int tVoltageMultiplier = material.vVoltageMultiplier; - Logger.WARNING("Generating Shaped Crafting recipes for "+material.getLocalizedName()); //TODO + Logger.WARNING("Generating Shaped Crafting recipes for "+material.getLocalizedName()); final ItemStack normalDust = material.getDust(1); final ItemStack smallDust = material.getSmallDust(1); diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index fd8e59662b..0dc4b4e170 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -3157,11 +3157,15 @@ item.FrothNickelflotation.name=Nickel Flotation Froth Cell item.FrothPlatinumflotation.name=Platinum Flotation Froth Cell item.FrothPentlanditeflotation.name=Pentlandite Flotation Froth Cell - +//Added 31/03/20 item.BasicGenericChemItem.9.name=Sodium Ethoxide Dust item.BasicGenericChemItem.10.name=Sodium Ethyl Xanthate Dust item.BasicGenericChemItem.11.name=Potassium Ethyl Xanthate Dust item.BasicGenericChemItem.12.name=Potassium Hydroxide Dust item.CarbonDisulfide.name=Carbon Disulfide Cell -item.HydrogenSulfide.name=Hydrogen Sulfide Cell
\ No newline at end of file +item.HydrogenSulfide.name=Hydrogen Sulfide Cell + +item.BasicAgrichemItem.24.name=Pinecone +item.BasicAgrichemItem.25.name=Crushed Pine Materials +item.pineoil.name=Pine Oil Cell
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/trees/leaves/leaves_pine.png b/src/resources/assets/miscutils/textures/blocks/trees/leaves/leaves_pine.png Binary files differnew file mode 100644 index 0000000000..68949e5f47 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/trees/leaves/leaves_pine.png diff --git a/src/resources/assets/miscutils/textures/blocks/trees/leaves/leaves_pine_opaque .png b/src/resources/assets/miscutils/textures/blocks/trees/leaves/leaves_pine_opaque .png Binary files differnew file mode 100644 index 0000000000..c7c0d6492f --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/trees/leaves/leaves_pine_opaque .png diff --git a/src/resources/assets/miscutils/textures/blocks/trees/saplings/sapling_pine.png b/src/resources/assets/miscutils/textures/blocks/trees/saplings/sapling_pine.png Binary files differnew file mode 100644 index 0000000000..f4c3ca84ac --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/trees/saplings/sapling_pine.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/24.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/24.png Binary files differnew file mode 100644 index 0000000000..0c065db4ce --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/24.png diff --git a/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/25.png b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/25.png Binary files differnew file mode 100644 index 0000000000..168b15adb3 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/bioscience/MetaItem1/25.png |