From baf1f6ff533b9ada00aeb7de98dd0bdaf5c28e10 Mon Sep 17 00:00:00 2001 From: Alkalus Date: Sat, 11 Apr 2020 22:40:18 +0100 Subject: + Added more milled materials. + Added proper structure for Flotation Cells. + Added all milled materials to flotation cell recipes. + Added Human meat drops for dead players. + Added Slicing mode for ICM. % Changed getVoltageForTier to be a switch case. % Stopped download of cape list in dev environment. $ Adjusted how Fusion MK4 injects power, it now pulls the voltage of the hatch. $ Fixed Fake Player Handling. --- src/Java/gregtech/api/util/Recipe_GT.java | 4 + src/Java/gtPlusPlus/RoadMap.java | 93 ++-- .../core/handler/events/BlockEventHandler.java | 18 +- .../core/handler/events/EntityDeathHandler.java | 65 ++- .../core/item/chemistry/MilledOreProcessing.java | 214 ++++++++- src/Java/gtPlusPlus/core/material/Material.java | 23 +- src/Java/gtPlusPlus/core/util/data/AES.java | 20 +- .../core/util/minecraft/MaterialUtils.java | 118 ++--- .../core/util/minecraft/PlayerUtils.java | 60 ++- src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java | 462 +++++++++++++++++++ src/Java/gtPlusPlus/nei/NEI_GT_Config.java | 2 + .../interfaces/internal/IGregtech_RecipeAdder.java | 3 + .../common/helpers/FlotationRecipeHandler.java | 79 ++++ .../gregtech/common/render/GTPP_CapeRenderer.java | 5 +- ...echMetaTileEntity_IndustrialCuttingMachine.java | 38 +- .../GregtechMetaTileEntity_Adv_Fusion_MK4.java | 93 ++++ .../production/GregtechMTE_FrothFlotationCell.java | 501 ++++++++++----------- .../xmod/gregtech/recipes/GregtechRecipeAdder.java | 53 ++- 18 files changed, 1384 insertions(+), 467 deletions(-) create mode 100644 src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java create mode 100644 src/Java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java diff --git a/src/Java/gregtech/api/util/Recipe_GT.java b/src/Java/gregtech/api/util/Recipe_GT.java index cb70d4a616..2927815edd 100644 --- a/src/Java/gregtech/api/util/Recipe_GT.java +++ b/src/Java/gregtech/api/util/Recipe_GT.java @@ -324,6 +324,10 @@ public class Recipe_GT extends GT_Recipe implements IComparableRecipe{ //Semi-Fluid Fuel Map public static final GT_Recipe_Map_Fuel sSemiFluidLiquidFuels = new GT_Recipe_Map_Fuel(new HashSet(10), "gt.recipe.semifluidgeneratorfuels", "Semifluid Generator Fuels", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); + + // Flotation Cell + public static final GT_Recipe_Map sFlotationCellRecipes = new GT_Recipe_Map(new HashSet(10000), "gt.recipe.flotationcell", "Flotation Cell", null, RES_PATH_GUI + "basicmachines/LFTR", 6, 4, 1, 1, 1, "Ore Key: ", 1, E, true, false); + diff --git a/src/Java/gtPlusPlus/RoadMap.java b/src/Java/gtPlusPlus/RoadMap.java index 95d00dab95..ac79089ba2 100644 --- a/src/Java/gtPlusPlus/RoadMap.java +++ b/src/Java/gtPlusPlus/RoadMap.java @@ -40,62 +40,41 @@ public class RoadMap { */ - /*private static final LinkedHashMap>mCachedResults = new LinkedHashMap>(); - public boolean contains(ItemStack aStack) { - if (aStack == null){ - return false; - } - ObjMap aCurrentSet; - if (mCachedResults.get(this.toString()) != null){ - aCurrentSet = mCachedResults.get(this.toString()); - } - - else { - aCurrentSet = new ObjMap(mPrefixedItems.size(), 0.5f); - mCachedResults.put(this.toString(), aCurrentSet); - } - - if (aCurrentSet.get(aStack.hashCode()) != null){ - return aCurrentSet.get(aStack.hashCode()); - } - else { - for (ItemStack tStack : mPrefixedItems){ - if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())){ - aCurrentSet.put(aStack.hashCode(), true); - return true; - } - } - } - aCurrentSet.put(aStack.hashCode(), false); - return false; - }*/ - - /*private static final LinkedHashMap>mCachedResults = new LinkedHashMap>(); - - public boolean contains(ItemStack aStack) { - if (aStack == null){ - return false; - } - ObjMap aCurrentSet = mCachedResults.get(this.toString().toUpperCase()); - if (aCurrentSet == null){ - aCurrentSet = new ObjMap((mPrefixedItems != null && mPrefixedItems.size() > 0 ? mPrefixedItems.size() : 1000), 0.5f); - mCachedResults.put(this.toString().toUpperCase(), aCurrentSet); - } - int mainHash = Objects.hashCode(aStack.getItem(), aStack.getItemDamage()); - Boolean result = aCurrentSet.get(mainHash); - if (result != null){ - return result; - } - else { - for (ItemStack tStack : mPrefixedItems){ - if (GT_Utility.areStacksEqual(aStack, tStack, !tStack.hasTagCompound())){ - aCurrentSet.put(Objects.hashCode(tStack.getItem(), tStack.getItemDamage()), true); - return true; - } - } - } - aCurrentSet.put(mainHash, false); - return false; - }*/ + /* + Thallium - Everglades only. + Technetium - Has some recipes but seem to be dead ends so unobtainable. + Polonium - Unobtainable. + Francium - Unobtainable. + Promethium - Unobtainable. + Radium - Everglades only. + Actinium - Unobtainable. + Proactinium - Unobtainable. + Neptunium - Has some recipes but seem to be dead ends so unobtainable. + Curium - Fusion only. + Berkelium - Unobtainable. + Californium - Fusion only. + Einsteinium - Unobtainable. + Fermium - Unobtainable. + Strontium - Everglades only. + Iodine - Everglades only. + Dysprosium - Everglades only. + Rhenium - Weird ABS recipe only. + Flerovium - Unobtainable. + Dubnium - Unobtainable. + Seaborgium - Unobtainable. + Bohrium - Unobtainable. + Hassium - Unobtainable. + Meitnerium - Unobtainable. + Darmstadtium - Unobtainable. + Roentgenium - Unobtainable. + Copernicium - Unobtainable. + Nihonium - Unobtainable. + Moscovium - Unobtainable. + Livermorium - Unobtainable. + Tennessine - Unobtainable. + Nobelium - Unobtainable. + Lawrencium - Unobtainable. + Astatine - Unobtainable. + */ } diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index b3738e6ea2..6da2dac38b 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -19,6 +19,7 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -87,7 +88,6 @@ public class BlockEventHandler { } - public static final Map mCachedFakePlayers = new WeakHashMap(); // Used to handle Thaumcraft Shards when TC is not installed. @SubscribeEvent @@ -97,21 +97,9 @@ public class BlockEventHandler { if (event != null && event.harvester != null && event.harvester.worldObj != null) { if (!event.harvester.worldObj.isRemote) { - EntityPlayer p = event.harvester; - ChunkCoordinates aChunkLocation = p.getPlayerCoordinates(); - - // Cache Fake Player - if (p instanceof FakePlayer || p instanceof FakeThaumcraftPlayer - || (event.harvester.getCommandSenderName() == null - || event.harvester.getCommandSenderName().length() <= 0) - || (p.isEntityInvulnerable() && !p.canCommandSenderUseCommand(0, "") - && (aChunkLocation.posX == 0 && aChunkLocation.posY == 0 - && aChunkLocation.posZ == 0))) { - mCachedFakePlayers.put(p.getUniqueID().toString(), p); - } + EntityPlayer p = event.harvester; - if (!mCachedFakePlayers.containsKey(event.harvester.getUniqueID().toString())) { - + if (PlayerUtils.isRealPlayer(p)) { // Spawns Fluorite from Lime Stone if (chanceToDropFluoriteOre != 0) { if (!oreLimestone.isEmpty() || !blockLimestone.isEmpty()) { diff --git a/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java b/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java index c4ab6edaa6..3492ee4788 100644 --- a/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/EntityDeathHandler.java @@ -7,18 +7,25 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Triplet; +import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.living.LivingDropsEvent; +import thaumcraft.common.lib.FakeThaumcraftPlayer; public class EntityDeathHandler { - - + + private static final HashMap>> mMobDropMap = new HashMap>>(); private static final HashSet mInternalClassKeyCache = new HashSet(); - + /** * Provides the ability to provide custom drops upon the death of EntityLivingBase objects. * @param aMobClass - The Base Class you want to drop this item. @@ -34,15 +41,15 @@ public class EntityDeathHandler { } aDataMap.put(aData); mMobDropMap.put(aMobClass, aDataMap); - + Logger.INFO("[Loot] Registered "+aStack.getDisplayName()+" (1-"+aMaxAmount+") as a valid drop for "+aMobClass.getCanonicalName()); - + if (!mInternalClassKeyCache.contains(aMobClass)) { mInternalClassKeyCache.add(aMobClass); } - + } - + private static ItemStack processItemDropTriplet(Triplet aData) { ItemStack aLoot = aData.getValue_1(); int aMaxDrop = aData.getValue_2(); @@ -55,7 +62,7 @@ public class EntityDeathHandler { } return null; } - + private static boolean processDropsForMob(EntityLivingBase entityLiving) { AutoMap> aMobData = mMobDropMap.get(entityLiving.getClass()); boolean aDidDrop = false; @@ -74,10 +81,30 @@ public class EntityDeathHandler { } return aDidDrop; } - - - - + + + + private static void dropMeatFromPlayer(EntityPlayer aPlayer) { + + // always drop some meat. + int aBigMeatStackSize1 = MathUtils.randInt(4, 8); + aPlayer.entityDropItem(ItemUtils.simpleMetaStack(ModItems.itemMetaFood, 0, aBigMeatStackSize1), MathUtils.randInt(0, 1)); + + // additional chances for more meat. + if (MathUtils.randInt(0, 10) < 7) { + int aBigMeatStackSize2 = MathUtils.randInt(4, 8); + aPlayer.entityDropItem(ItemUtils.simpleMetaStack(ModItems.itemMetaFood, 0, aBigMeatStackSize2), MathUtils.randInt(0, 1)); + } + if (MathUtils.randInt(0, 10) < 4) { + int aBigMeatStackSize3 = MathUtils.randInt(4, 8); + aPlayer.entityDropItem(ItemUtils.simpleMetaStack(ModItems.itemMetaFood, 0, aBigMeatStackSize3), MathUtils.randInt(0, 1)); + } + if (MathUtils.randInt(0, 10) < 2) { + int aBigMeatStackSize4 = MathUtils.randInt(4, 8); + aPlayer.entityDropItem(ItemUtils.simpleMetaStack(ModItems.itemMetaFood, 0, aBigMeatStackSize4), MathUtils.randInt(0, 1)); + } + + } @SubscribeEvent public void onEntityDrop(LivingDropsEvent event) { @@ -85,10 +112,16 @@ public class EntityDeathHandler { if (event == null || event.entityLiving == null) { return; } - for (Class c : mInternalClassKeyCache) { - if (c.isInstance(event.entityLiving)) { - aDidDrop = processDropsForMob(event.entityLiving); - } + if (PlayerUtils.isRealPlayer(event.entityLiving)) { + EntityPlayer aPlayer = (EntityPlayer) event.entityLiving; + dropMeatFromPlayer(aPlayer); + } + else { + for (Class c : mInternalClassKeyCache) { + if (c.isInstance(event.entityLiving)) { + aDidDrop = processDropsForMob(event.entityLiving); + } + } } } diff --git a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java index 3583ddca3f..1de58c36aa 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java @@ -27,12 +27,18 @@ public class MilledOreProcessing extends ItemPackage { * Fluids */ - public static Fluid ZincFlotationFroth; - public static Fluid CopperFlotationFroth; + public static Fluid SphaleriteFlotationFroth; + public static Fluid ChalcopyriteFlotationFroth; public static Fluid NickelFlotationFroth; public static Fluid PlatinumFlotationFroth; public static Fluid PentlanditeFlotationFroth; + public static Fluid RedstoneFlotationFroth; + public static Fluid SpessartineFlotationFroth; + public static Fluid GrossularFlotationFroth; + public static Fluid AlmandineFlotationFroth; + public static Fluid PyropeFlotationFroth; + public static Fluid PineOil; @@ -54,16 +60,40 @@ public class MilledOreProcessing extends ItemPackage { // Iron, Nickel, Promethium, Hafnium public static Item milledPentlandite; - + + + + + // Redstone, Ruby, Chrome, Firestone + public static Item milledRedstone; + + // Manganese, Aluminium, ???, ??? + public static Item milledSpessartine; + + // Calcium, Aluminium, ???, ??? + public static Item milledGrossular; + + // Iron, Aluminium, Magnesium, Ytterbium + public static Item milledAlmandine; + + // Magnesium, Aluminium, Chrome, Manganese + public static Item milledPyrope; + @Override public void items() { - milledSphalerite = BaseItemMilledOre.generate(Materials.Sphalerite, MaterialUtils.getVoltageForTier(5)); - milledChalcopyrite = BaseItemMilledOre.generate(Materials.Chalcopyrite, MaterialUtils.getVoltageForTier(4)); - milledNickel = BaseItemMilledOre.generate(Materials.Nickel, MaterialUtils.getVoltageForTier(4)); - milledPlatinum = BaseItemMilledOre.generate(Materials.Platinum, MaterialUtils.getVoltageForTier(5)); - milledPentlandite = BaseItemMilledOre.generate(Materials.Pentlandite, MaterialUtils.getVoltageForTier(5)); + milledSphalerite = BaseItemMilledOre.generate(Materials.Sphalerite, MaterialUtils.getVoltageForTier(6)); + milledChalcopyrite = BaseItemMilledOre.generate(Materials.Chalcopyrite, MaterialUtils.getVoltageForTier(5)); + milledNickel = BaseItemMilledOre.generate(Materials.Nickel, MaterialUtils.getVoltageForTier(5)); + milledPlatinum = BaseItemMilledOre.generate(Materials.Platinum, MaterialUtils.getVoltageForTier(6)); + milledPentlandite = BaseItemMilledOre.generate(Materials.Pentlandite, MaterialUtils.getVoltageForTier(6)); + + milledRedstone = BaseItemMilledOre.generate(Materials.Redstone, MaterialUtils.getVoltageForTier(5)); + milledSpessartine = BaseItemMilledOre.generate(Materials.Spessartine, MaterialUtils.getVoltageForTier(6)); + milledGrossular = BaseItemMilledOre.generate(Materials.Grossular, MaterialUtils.getVoltageForTier(6)); + milledAlmandine = BaseItemMilledOre.generate(Materials.Almandine, MaterialUtils.getVoltageForTier(6)); + milledPyrope = BaseItemMilledOre.generate(Materials.Pyrope, MaterialUtils.getVoltageForTier(4)); } @@ -76,9 +106,9 @@ public class MilledOreProcessing extends ItemPackage { 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); + SphaleriteFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.zincflotation", "Sphalerite Froth", 32 + 175, new short[] { aZincFrothRGB[0], aZincFrothRGB[1], aZincFrothRGB[2], 100 }, true); short[] aCopperFrothRGB = Materials.Chalcopyrite.mRGBa; - CopperFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.copperflotation", "Copper Froth", 32 + 175, new short[] { aCopperFrothRGB[0], aCopperFrothRGB[1], aCopperFrothRGB[2], 100 }, true); + ChalcopyriteFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.copperflotation", "Chalcopyrite Froth", 32 + 175, new short[] { aCopperFrothRGB[0], aCopperFrothRGB[1], aCopperFrothRGB[2], 100 }, true); short[] aNickelFrothRGB = Materials.Nickel.mRGBa; NickelFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.nickelflotation", "Nickel Froth", 32 + 175, new short[] { aNickelFrothRGB[0], aNickelFrothRGB[1], aNickelFrothRGB[2], 100 }, true); short[] aPlatinumFrothRGB = Materials.Platinum.mRGBa; @@ -86,6 +116,18 @@ 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); + short[] aRedstoneFrothRGB = Materials.Redstone.mRGBa; + RedstoneFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.redstoneflotation", "Redstone Froth", 32 + 175, new short[] { aRedstoneFrothRGB[0], aRedstoneFrothRGB[1], aRedstoneFrothRGB[2], 100 }, true); + short[] aSpessartineFrothRGB = Materials.Spessartine.mRGBa; + SpessartineFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.spessartineflotation", "Spessartine Froth", 32 + 175, new short[] { aSpessartineFrothRGB[0], aSpessartineFrothRGB[1], aSpessartineFrothRGB[2], 100 }, true); + short[] aGrossularFrothRGB = Materials.Grossular.mRGBa; + GrossularFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.grossularflotation", "Grossular Froth", 32 + 175, new short[] { aGrossularFrothRGB[0], aGrossularFrothRGB[1], aGrossularFrothRGB[2], 100 }, true); + short[] aAlmandineFrothRGB = Materials.Almandine.mRGBa; + AlmandineFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.almandineflotation", "Almandine Froth", 32 + 175, new short[] { aAlmandineFrothRGB[0], aAlmandineFrothRGB[1], aAlmandineFrothRGB[2], 100 }, true); + short[] aPyropeFrothRGB = Materials.Pyrope.mRGBa; + PyropeFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.pyropeflotation", "Pyrope Froth", 32 + 175, new short[] { aPyropeFrothRGB[0], aPyropeFrothRGB[1], aPyropeFrothRGB[2], 100 }, true); + + PineOil = FluidUtils.generateFluidNoPrefix("pineoil", "Pine Oil", 32 + 175, new short[] { 250, 200, 60, 100 }, true); } @@ -126,8 +168,160 @@ public class MilledOreProcessing extends ItemPackage { public boolean generateRecipes() { addMiscRecipes(); addPineOilExtraction(); + addFlotationRecipes1(); + addFlotationRecipes2(); return true; } + + private void addFlotationRecipes2() { + + // Redstone + CORE.RA.addFlotationRecipe( + Materials.Redstone, + ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 3000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(RedstoneFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(5) + ); + + // Spessartine + CORE.RA.addFlotationRecipe( + Materials.Spessartine, + ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 5000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(SpessartineFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(6) + ); + + // Grossular + CORE.RA.addFlotationRecipe( + Materials.Grossular, + ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 5000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(GrossularFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(6) + ); + + // Almandine + CORE.RA.addFlotationRecipe( + Materials.Almandine, + ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 4000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(AlmandineFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(5) + ); + + // Pyrope + CORE.RA.addFlotationRecipe( + Materials.Pyrope, + ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 2000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(PyropeFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(4) + ); + + } + + private void addFlotationRecipes1() { + + // Sphalerite + CORE.RA.addFlotationRecipe( + Materials.Sphalerite, + ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 4000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(SphaleriteFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(6) + ); + + // Chalcopyrite + CORE.RA.addFlotationRecipe( + Materials.Chalcopyrite, + ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 4000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(ChalcopyriteFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(5) + ); + + // Nickel + CORE.RA.addFlotationRecipe( + Materials.Nickel, + ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 5000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(NickelFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(5) + ); + + // Platinum + CORE.RA.addFlotationRecipe( + Materials.Platinum, + ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 5000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(PlatinumFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(6) + ); + + + // Pentlandite + CORE.RA.addFlotationRecipe( + Materials.Pentlandite, + ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1), + new FluidStack[] { + FluidUtils.getFluidStack(PineOil, 4000), + }, + new FluidStack[] { + FluidUtils.getFluidStack(PentlanditeFlotationFroth, 1000) + }, + 20 * 1200, + MaterialUtils.getVoltageForTier(6) + ); + + + } private void addPineOilExtraction() { AutoMap aLogs = new AutoMap(); diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 7d49a8d635..dee064353a 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -3,11 +3,7 @@ package gtPlusPlus.core.material; import static gregtech.api.enums.GT_Values.M; import static gtPlusPlus.core.util.math.MathUtils.safeCast_LongToInt; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import java.util.*; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -1304,6 +1300,23 @@ public class Material { } + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (!Material.class.isInstance(obj)) { + return false; + } + Material aObj = (Material) obj; + if (aObj.unlocalizedName.equals(this.unlocalizedName)) { + if (aObj.localizedName.equals(this.localizedName)) { + return true; + } + } + return false; + } + public boolean registerComponentForMaterial(FluidStack aStack) { return registerComponentForMaterial(this, aStack); } diff --git a/src/Java/gtPlusPlus/core/util/data/AES.java b/src/Java/gtPlusPlus/core/util/data/AES.java index 9b0126f17d..1183cdd8e7 100644 --- a/src/Java/gtPlusPlus/core/util/data/AES.java +++ b/src/Java/gtPlusPlus/core/util/data/AES.java @@ -1,19 +1 @@ -package gtPlusPlus.core.util.data; - -import java.io.UnsupportedEncodingException; -import java.math.BigInteger; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Arrays; -import java.util.Base64; - -import javax.crypto.Cipher; -import javax.crypto.spec.SecretKeySpec; - -public class AES { - - \u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u0020\u003d\u0020\u0022\u0044\u0061\u0072\u006b\u006e\u0065\u0073\u0073\u0020\u0049\u006e\u0020\u0054\u0068\u0065\u0069\u0072\u0020\u0048\u0065\u0061\u0072\u0074\u0073\u0022\u003b\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u003b\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u006b\u0065\u0079\u003b - \u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0041\u0045\u0053\u0028\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u006b\u0065\u0079\u0020\u003d\u0020\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0067\u0065\u0074\u0048\u0061\u0073\u0068\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0073\u0065\u0063\u0072\u0065\u0074\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0020\u003d\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u004b\u0065\u0079\u0028\u006b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0067\u0065\u0074\u0048\u0061\u0073\u0068\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0061\u0053\u0074\u0072\u0069\u006e\u0067\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u006f\u0048\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0067\u0065\u0074\u0053\u0048\u0041\u0028\u0061\u0053\u0074\u0072\u0069\u006e\u0067\u0029\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0067\u0065\u0074\u0053\u0048\u0041\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0069\u006e\u0070\u0075\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u0020\u006d\u0064\u003b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u006d\u0064\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0053\u0048\u0041\u002d\u0032\u0035\u0036\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006d\u0064\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u0069\u006e\u0070\u0075\u0074\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064\u0043\u0068\u0061\u0072\u0073\u0065\u0074\u0073\u002e\u0055\u0054\u0046\u005f\u0038\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u007b\u007d\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u006f\u0048\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0068\u0061\u0073\u0068\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u0028\u0031\u002c\u0020\u0068\u0061\u0073\u0068\u0029\u003b\u000d\u000a\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0042\u0075\u0069\u006c\u0064\u0065\u0072\u0020\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0042\u0075\u0069\u006c\u0064\u0065\u0072\u0028\u006e\u0075\u006d\u0062\u0065\u0072\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0031\u0036\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u006c\u0065\u006e\u0067\u0074\u0068\u0028\u0029\u0020\u003c\u0020\u0033\u0032\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u0069\u006e\u0073\u0065\u0072\u0074\u0028\u0030\u002c\u0020\u0027\u0030\u0027\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0061\u004b\u0065\u0079\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u003b\u000d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u0020\u0073\u0068\u0061\u003b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0073\u0068\u0061\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0053\u0048\u0041\u002d\u0032\u0035\u0036\u0022\u0029\u003b\u000d\u000a\u0009\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0073\u0068\u0061\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u0061\u004b\u0065\u0079\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064\u0043\u0068\u0061\u0072\u0073\u0065\u0074\u0073\u002e\u0055\u0054\u0046\u005f\u0038\u0029\u0029\u003b\u0020\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0065\u0031\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0009\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u0061\u004b\u0065\u0079\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0022\u0055\u0054\u0046\u002d\u0038\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0073\u0068\u0061\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0053\u0048\u0041\u002d\u0031\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u0073\u0068\u0061\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u006b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u0041\u0072\u0072\u0061\u0079\u0073\u002e\u0063\u006f\u0070\u0079\u004f\u0066\u0028\u006b\u0065\u0079\u002c\u0020\u0031\u0036\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u003b\u000d\u000a\u0009\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u007d\u0009\u0009\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u007b\u007d\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u004b\u0065\u0079\u0028\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0061\u004b\u0065\u0079\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0028\u0061\u004b\u0065\u0079\u002c\u0020\u0022\u0041\u0045\u0053\u0022\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u000d\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0074\u0072\u0054\u006f\u0044\u0065\u0063\u0072\u0079\u0070\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0043\u0069\u0070\u0068\u0065\u0072\u0020\u0063\u0069\u0070\u0068\u0065\u0072\u0020\u003d\u0020\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0041\u0045\u0053\u002f\u0045\u0043\u0042\u002f\u0050\u004b\u0043\u0053\u0035\u0050\u0041\u0044\u0044\u0049\u004e\u0047\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0069\u006e\u0069\u0074\u0028\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0044\u0045\u0043\u0052\u0059\u0050\u0054\u005f\u004d\u004f\u0044\u0045\u002c\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0064\u006f\u0046\u0069\u006e\u0061\u006c\u0028\u0042\u0061\u0073\u0065\u0036\u0034\u002e\u0067\u0065\u0074\u0044\u0065\u0063\u006f\u0064\u0065\u0072\u0028\u0029\u002e\u0064\u0065\u0063\u006f\u0064\u0065\u0028\u0073\u0074\u0072\u0054\u006f\u0044\u0065\u0063\u0072\u0079\u0070\u0074\u0029\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0075\u006c\u006c\u003b\u000d\u000a\u0009\u007d - -} +\u0070\u0061\u0063\u006b\u0061\u0067\u0065\u0020\u0067\u0074\u0050\u006c\u0075\u0073\u0050\u006c\u0075\u0073\u002e\u0063\u006f\u0072\u0065\u002e\u0075\u0074\u0069\u006c\u002e\u0064\u0061\u0074\u0061\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0069\u006f\u002e\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u006d\u0061\u0074\u0068\u002e\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u006e\u0069\u006f\u002e\u0063\u0068\u0061\u0072\u0073\u0065\u0074\u002e\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064\u0043\u0068\u0061\u0072\u0073\u0065\u0074\u0073\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0073\u0065\u0063\u0075\u0072\u0069\u0074\u0079\u002e\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0073\u0065\u0063\u0075\u0072\u0069\u0074\u0079\u002e\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0075\u0074\u0069\u006c\u002e\u0041\u0072\u0072\u0061\u0079\u0073\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u002e\u0075\u0074\u0069\u006c\u002e\u0042\u0061\u0073\u0065\u0036\u0034\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u0078\u002e\u0063\u0072\u0079\u0070\u0074\u006f\u002e\u0043\u0069\u0070\u0068\u0065\u0072\u003b\u000d\u000a\u0069\u006d\u0070\u006f\u0072\u0074\u0020\u006a\u0061\u0076\u0061\u0078\u002e\u0063\u0072\u0079\u0070\u0074\u006f\u002e\u0073\u0070\u0065\u0063\u002e\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u003b\u000d\u000a\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0063\u006c\u0061\u0073\u0073\u0020\u0041\u0045\u0053\u0020\u007b\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u003b\u003b\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u003b\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u006b\u0065\u0079\u003b\u0009\u000d\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0041\u0045\u0053\u0028\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0074\u0068\u0069\u0073\u0028\u0022\u0044\u0061\u0072\u006b\u006e\u0065\u0073\u0073\u0020\u0049\u006e\u0020\u0054\u0068\u0065\u0069\u0072\u0020\u0048\u0065\u0061\u0072\u0074\u0073\u0022\u0029\u003b\u0009\u0009\u000d\u000a\u0009\u007d\u0009\u000d\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0041\u0045\u0053\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0061\u0053\u0065\u0063\u0072\u0065\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0073\u0065\u0063\u0072\u0065\u0074\u0020\u003d\u0020\u0061\u0053\u0065\u0063\u0072\u0065\u0074\u003b\u000d\u000a\u0009\u0009\u006b\u0065\u0079\u0020\u003d\u0020\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0067\u0065\u0074\u0048\u0061\u0073\u0068\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0073\u0065\u0063\u0072\u0065\u0074\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0020\u003d\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u004b\u0065\u0079\u0028\u006b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0067\u0065\u0074\u0048\u0061\u0073\u0068\u0065\u0064\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0061\u0053\u0074\u0072\u0069\u006e\u0067\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u006f\u0048\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0067\u0065\u0074\u0053\u0048\u0041\u0028\u0061\u0053\u0074\u0072\u0069\u006e\u0067\u0029\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0067\u0065\u0074\u0053\u0048\u0041\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0069\u006e\u0070\u0075\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u0020\u006d\u0064\u003b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u006d\u0064\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0053\u0048\u0041\u002d\u0032\u0035\u0036\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006d\u0064\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u0069\u006e\u0070\u0075\u0074\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064\u0043\u0068\u0061\u0072\u0073\u0065\u0074\u0073\u002e\u0055\u0054\u0046\u005f\u0038\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u007b\u007d\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u006f\u0048\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0068\u0061\u0073\u0068\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u0020\u006e\u0075\u006d\u0062\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0042\u0069\u0067\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u0028\u0031\u002c\u0020\u0068\u0061\u0073\u0068\u0029\u003b\u000d\u000a\u0009\u0009\u0053\u0074\u0072\u0069\u006e\u0067\u0042\u0075\u0069\u006c\u0064\u0065\u0072\u0020\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0042\u0075\u0069\u006c\u0064\u0065\u0072\u0028\u006e\u0075\u006d\u0062\u0065\u0072\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0031\u0036\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u006c\u0065\u006e\u0067\u0074\u0068\u0028\u0029\u0020\u003c\u0020\u0033\u0032\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u0069\u006e\u0073\u0065\u0072\u0074\u0028\u0030\u002c\u0020\u0027\u0030\u0027\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0068\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0061\u004b\u0065\u0079\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u003b\u000d\u000a\u0009\u0009\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u0020\u0073\u0068\u0061\u003b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0073\u0068\u0061\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0053\u0048\u0041\u002d\u0032\u0035\u0036\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0073\u0068\u0061\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u0061\u004b\u0065\u0079\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0053\u0074\u0061\u006e\u0064\u0061\u0072\u0064\u0043\u0068\u0061\u0072\u0073\u0065\u0074\u0073\u002e\u0055\u0054\u0046\u005f\u0038\u0029\u0029\u003b\u0020\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0065\u0031\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0009\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u0061\u004b\u0065\u0079\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0022\u0055\u0054\u0046\u002d\u0038\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0073\u0068\u0061\u0020\u003d\u0020\u004d\u0065\u0073\u0073\u0061\u0067\u0065\u0044\u0069\u0067\u0065\u0073\u0074\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0053\u0048\u0041\u002d\u0031\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u0073\u0068\u0061\u002e\u0064\u0069\u0067\u0065\u0073\u0074\u0028\u006b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u0020\u003d\u0020\u0041\u0072\u0072\u0061\u0079\u0073\u002e\u0063\u006f\u0070\u0079\u004f\u0066\u0028\u006b\u0065\u0079\u002c\u0020\u0031\u0036\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0061\u004b\u0065\u0079\u0044\u0061\u0074\u0061\u003b\u000d\u000a\u0009\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u004e\u006f\u0053\u0075\u0063\u0068\u0041\u006c\u0067\u006f\u0072\u0069\u0074\u0068\u006d\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0055\u006e\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u007d\u0009\u0009\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u007b\u007d\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0072\u0069\u0076\u0061\u0074\u0065\u0020\u0066\u0069\u006e\u0061\u006c\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0020\u0067\u0065\u006e\u0065\u0072\u0061\u0074\u0065\u004b\u0065\u0079\u0028\u0062\u0079\u0074\u0065\u005b\u005d\u0020\u0061\u004b\u0065\u0079\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0053\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0053\u0070\u0065\u0063\u0028\u0061\u004b\u0065\u0079\u002c\u0020\u0022\u0041\u0045\u0053\u0022\u0029\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0065\u006e\u0063\u006f\u0064\u0065\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0074\u0072\u0054\u006f\u0045\u006e\u0063\u0072\u0079\u0070\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0043\u0069\u0070\u0068\u0065\u0072\u0020\u0063\u0069\u0070\u0068\u0065\u0072\u0020\u003d\u0020\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0041\u0045\u0053\u002f\u0045\u0043\u0042\u002f\u0050\u004b\u0043\u0053\u0035\u0050\u0061\u0064\u0064\u0069\u006e\u0067\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0069\u006e\u0069\u0074\u0028\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0045\u004e\u0043\u0052\u0059\u0050\u0054\u005f\u004d\u004f\u0044\u0045\u002c\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0042\u0061\u0073\u0065\u0036\u0034\u002e\u0067\u0065\u0074\u0045\u006e\u0063\u006f\u0064\u0065\u0072\u0028\u0029\u002e\u0065\u006e\u0063\u006f\u0064\u0065\u0054\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0064\u006f\u0046\u0069\u006e\u0061\u006c\u0028\u0073\u0074\u0072\u0054\u006f\u0045\u006e\u0063\u0072\u0079\u0070\u0074\u002e\u0067\u0065\u0074\u0042\u0079\u0074\u0065\u0073\u0028\u0022\u0055\u0054\u0046\u002d\u0038\u0022\u0029\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0022\u0045\u0072\u0072\u006f\u0072\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u0065\u006e\u0063\u0072\u0079\u0070\u0074\u0069\u006e\u0067\u003a\u0020\u0022\u0020\u002b\u0020\u0065\u002e\u0074\u006f\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0075\u006c\u006c\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u0009\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0064\u0065\u0063\u006f\u0064\u0065\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0074\u0072\u0054\u006f\u0044\u0065\u0063\u0072\u0079\u0070\u0074\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000d\u000a\u0009\u0009\u0009\u0043\u0069\u0070\u0068\u0065\u0072\u0020\u0063\u0069\u0070\u0068\u0065\u0072\u0020\u003d\u0020\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0022\u0041\u0045\u0053\u002f\u0045\u0043\u0042\u002f\u0050\u004b\u0043\u0053\u0035\u0050\u0041\u0044\u0044\u0049\u004e\u0047\u0022\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0069\u006e\u0069\u0074\u0028\u0043\u0069\u0070\u0068\u0065\u0072\u002e\u0044\u0045\u0043\u0052\u0059\u0050\u0054\u005f\u004d\u004f\u0044\u0045\u002c\u0020\u0073\u0065\u0063\u0072\u0065\u0074\u004b\u0065\u0079\u0029\u003b\u000d\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0065\u0077\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0063\u0069\u0070\u0068\u0065\u0072\u002e\u0064\u006f\u0046\u0069\u006e\u0061\u006c\u0028\u0042\u0061\u0073\u0065\u0036\u0034\u002e\u0067\u0065\u0074\u0044\u0065\u0063\u006f\u0064\u0065\u0072\u0028\u0029\u002e\u0064\u0065\u0063\u006f\u0064\u0065\u0028\u0073\u0074\u0072\u0054\u006f\u0044\u0065\u0063\u0072\u0079\u0070\u0074\u0029\u0029\u0029\u003b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0029\u0020\u007b\u000d\u000a\u0009\u0009\u007d\u000d\u000a\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u006e\u0075\u006c\u006c\u003b\u000d\u000a\u0009\u007d\u000d\u000a\u007d \ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java index 64a6c9e820..7e9e34ae47 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/MaterialUtils.java @@ -209,10 +209,10 @@ public class MaterialUtils { } public static int getTierOfMaterial(final double aMeltingPoint){ - + return aMeltingPoint < 1000 ? 0 : (MathUtils.roundToClosestInt(aMeltingPoint/1000f)); - - + + /*if ((aMeltingPoint >= 0) && (aMeltingPoint <= 1000)){ return 1; } @@ -250,40 +250,42 @@ public class MaterialUtils { public static int getVoltageForTier(int aTier) { //aTier += 1; - Probably some logic to this, idk. - if (aTier <= 0) { - return 16; - } else if (aTier == 1) { - return 30; - } else if (aTier == 2) { - return 120; - } else if (aTier == 3) { - return 480; - } else if (aTier == 4) { - return 1920; - } else if (aTier == 5) { - return 7680; - } else if (aTier == 6) { - return 30720; - } else if (aTier == 7) { - return 122880; - } else if (aTier == 8) { - return 491520; - } else if (aTier == 9) { - return 1966080; - } else if (aTier == 10) { - return 7864320; - } else if (aTier == 11) { - return 31457280; - } else if (aTier == 12) { - return 125829120; - } else if (aTier == 13) { - return 503316480; - } else if (aTier == 14) { - return 2013265920; - } else { - return Integer.MAX_VALUE; - } - + + switch(aTier){ + case 0: + return 16; + case 1: + return 30; + case 2: + return 120; + case 3: + return 480; + case 4: + return 1920; + case 5: + return 7680; + case 6: + return 30720; + case 7: + return 122880; + case 8: + return 491520; + case 9: + return 1966080; + case 10: + return 7864320; + case 11: + return 31457280; + case 12: + return 125829120; + case 13: + return 503316480; + case 14: + return 2013265920; + default: + return Integer.MAX_VALUE; + } + /*else { int newTier = aTier - 1; return (int) ((4*(Math.pow(4, newTier)))*7.5); @@ -342,7 +344,7 @@ public class MaterialUtils { TextureSet o = (r != null && r.isPresent() && r.get() != null) ? r.get() : null; return o;*/ } - + public static Materials getMaterial(String aMaterialName, String aFallbackMaterialName) { @@ -416,7 +418,7 @@ public class MaterialUtils { return aDataSet; } return aDataSet; - */} + */} public static AutoMap getCompoundMaterialsRecursively_Speiger(Material toSearch) { AutoMap resultList = new AutoMap(); @@ -425,11 +427,11 @@ public class MaterialUtils { return resultList; } final int HARD_LIMIT = 1000; - + // Could be a Deque but i dont use the interface // enough to use it as default. LinkedList toCheck = new LinkedList(); - + toCheck.add(toSearch); int processed = 0; while (toCheck.size() > 0 && processed < HARD_LIMIT) { @@ -445,11 +447,11 @@ public class MaterialUtils { } return resultList; } - + public static void generateComponentAndAssignToAMaterial(ComponentTypes aType, Material aMaterial) { generateComponentAndAssignToAMaterial(aType, aMaterial, true); } - + public static void generateComponentAndAssignToAMaterial(ComponentTypes aType, Material aMaterial, boolean generateRecipes) { Item aGC; if (aType == ComponentTypes.PLATEHEAVY) { @@ -460,33 +462,33 @@ public class MaterialUtils { } if (aGC != null) { String aFormattedLangName = aType.getName(); - + if (!aFormattedLangName.startsWith(" ")) { if (aFormattedLangName.contains("@")) { String[] aSplit = aFormattedLangName.split("@"); aFormattedLangName = aSplit[0] + " " + aMaterial.getLocalizedName() + " " + aSplit[1]; } } - + if (aFormattedLangName.equals(aType.getName())) { aFormattedLangName = aMaterial.getLocalizedName() + aFormattedLangName; - + } - - - + + + Logger.MATERIALS("[Lang] "+aGC.getUnlocalizedName()+".name="+aFormattedLangName); aMaterial.registerComponentForMaterial(aType, ItemUtils.getSimpleStack(aGC)); } } - - - - - - - - + + + + + + + + public static void generateSpecialDustAndAssignToAMaterial(Material aMaterial) { generateSpecialDustAndAssignToAMaterial(aMaterial, true); } @@ -498,7 +500,7 @@ public class MaterialUtils { aMaterial.registerComponentForMaterial(OrePrefixes.dustSmall, ItemUtils.getSimpleStack(aDusts[1])); aMaterial.registerComponentForMaterial(OrePrefixes.dustTiny, ItemUtils.getSimpleStack(aDusts[2])); } - + } public static boolean doesMaterialExist(String aMatName) { diff --git a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java index e64414b493..110b2baf25 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/PlayerUtils.java @@ -1,23 +1,27 @@ package gtPlusPlus.core.util.minecraft; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; +import java.util.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.handler.events.BlockEventHandler; import gtPlusPlus.core.util.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.world.World; +import net.minecraftforge.common.util.FakePlayer; +import thaumcraft.common.lib.FakeThaumcraftPlayer; public class PlayerUtils { + public static final Map mCachedFakePlayers = new WeakHashMap(); + public static void messagePlayer(final EntityPlayer P, final String S){ gregtech.api.util.GT_Utility.sendChatToPlayer(P, S); } @@ -195,5 +199,53 @@ public class PlayerUtils { public static boolean canTakeDamage(EntityPlayer aPlayer) { return !aPlayer.capabilities.disableDamage; } + + public static void cacheFakePlayer(EntityPlayer aPlayer) { + ChunkCoordinates aChunkLocation = aPlayer.getPlayerCoordinates(); + // Cache Fake Player + if (aPlayer instanceof FakePlayer || aPlayer instanceof FakeThaumcraftPlayer + || (aPlayer.getCommandSenderName() == null + || aPlayer.getCommandSenderName().length() <= 0) + || (aPlayer.isEntityInvulnerable() && !aPlayer.canCommandSenderUseCommand(0, "") + && (aChunkLocation == null) || (aChunkLocation.posX == 0 && aChunkLocation.posY == 0 + && aChunkLocation.posZ == 0))) { + mCachedFakePlayers.put(aPlayer.getUniqueID().toString(), aPlayer); + } + } + + public static boolean isCachedFakePlayer(String aUUID) { + return mCachedFakePlayers.containsKey(aUUID); + } + + public static boolean isRealPlayer(EntityLivingBase aEntity) { + if (aEntity instanceof EntityPlayer) { + EntityPlayer p = (EntityPlayer) aEntity; + ChunkCoordinates aChunkLocation = p.getPlayerCoordinates(); + if (p instanceof FakePlayer) { + cacheFakePlayer(p); + return false; + } + if (p instanceof FakeThaumcraftPlayer) { + cacheFakePlayer(p); + return false; + } + if (p.getCommandSenderName() == null) { + cacheFakePlayer(p); + return false; + } + if (p.getCommandSenderName().length() <= 0) { + cacheFakePlayer(p); + return false; + } + if (p.isEntityInvulnerable() && !p.canCommandSenderUseCommand(0, "") && (aChunkLocation.posX == 0 && aChunkLocation.posY == 0 && aChunkLocation.posZ == 0)) { + cacheFakePlayer(p); + return false; + } + if (!isCachedFakePlayer(p.getUniqueID().toString())) { + return true; + } + } + return false; + } } diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java b/src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java new file mode 100644 index 0000000000..0d4e84b4b7 --- /dev/null +++ b/src/Java/gtPlusPlus/nei/GT_NEI_FlotationCell.java @@ -0,0 +1,462 @@ +package gtPlusPlus.nei; + +import java.awt.Point; +import java.awt.Rectangle; +import java.util.*; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.PositionedStack; +import codechicken.nei.guihook.GuiContainerManager; +import codechicken.nei.guihook.IContainerInputHandler; +import codechicken.nei.guihook.IContainerTooltipHandler; +import codechicken.nei.recipe.*; +import cpw.mods.fml.common.event.FMLInterModComms; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.gui.GT_GUIContainer_BasicMachine; +import gregtech.api.objects.ItemData; +import gregtech.api.util.*; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class GT_NEI_FlotationCell +extends TemplateRecipeHandler { + public static final int sOffsetX = 5; + public static final int sOffsetY = 11; + + static { + GuiContainerManager.addInputHandler(new GT_RectHandler()); + GuiContainerManager.addTooltipHandler(new GT_RectHandler()); + } + + protected GT_Recipe_Map mRecipeMap; + + public GT_NEI_FlotationCell() { + this.mRecipeMap = Gregtech_Recipe_Map.sFlotationCellRecipes; + this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), this.getRecipeMapName(), new Object[0])); + if (!NEI_GT_Config.sIsAdded) { + FMLInterModComms.sendRuntimeMessage(GT_Values.GT, "NEIPlugins", "register-crafting-handler", "gregtechplusplus@" + this.getRecipeName() + "@" + this.getRecipeMapName()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } + + public List getSortedRecipes() { + List result = new ArrayList(this.mRecipeMap.mRecipeList); + Collections.sort(result); + return result; + } + + public static void drawText(final int aX, final int aY, final String aString, final int aColor) { + Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); + } + + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_FlotationCell(); + } + + @Override + public void loadCraftingRecipes(final String outputId, final Object... results) { + if (outputId.equals(getRecipeMapName())) { + for (Recipe_GT tRecipe : getSortedRecipes()) { + if (!tRecipe.mHidden) { + this.arecipes.add(new CachedDefaultRecipe(tRecipe)); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(final ItemStack aResult) { + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); + + ArrayList tResults = new ArrayList(); + tResults.add(aResult); + tResults.add(GT_OreDictUnificator.get(true, aResult)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aResult, true); + if (tFluid != null) { + tResults.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tResults.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (Recipe_GT tRecipe : getSortedRecipes()) { + if (!tRecipe.mHidden) { + CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (ItemStack tStack : tResults) { + if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + //CachedDefaultRecipe tNEIRecipe; + } + + public void loadUsageRecipes(ItemStack aInput) { + ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); + + ArrayList tInputs = new ArrayList(); + tInputs.add(aInput); + tInputs.add(GT_OreDictUnificator.get(false, aInput)); + if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { + tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); + } + } + FluidStack tFluid = GT_Utility.getFluidForFilledItem(aInput, true); + if (tFluid != null) { + tInputs.add(GT_Utility.getFluidDisplayStack(tFluid, false)); + for (FluidContainerRegistry.FluidContainerData tData : FluidContainerRegistry.getRegisteredFluidContainerData()) { + if (tData.fluid.isFluidEqual(tFluid)) { + tInputs.add(GT_Utility.copy(new Object[]{tData.filledContainer})); + } + } + } + for (Recipe_GT tRecipe : getSortedRecipes()) { + if (!tRecipe.mHidden) { + CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); + for (ItemStack tStack : tInputs) { + if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { + this.arecipes.add(tNEIRecipe); + break; + } + } + } + } + //CachedDefaultRecipe tNEIRecipe; + } + + public String getRecipeMapName() { + return this.mRecipeMap.mNEIName; + } + + @Override + public String getOverlayIdentifier() { + return this.mRecipeMap.mNEIName; + } + + @Override + public void drawBackground(final int recipe) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); + } + + @Override + public int recipiesPerPage() { + return 1; + } + + @Override + public String getRecipeName() { + return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + } + + @Override + public String getGuiTexture() { + return this.mRecipeMap.mNEIGUIPath; + } + + @Override + public List handleItemTooltip(final GuiRecipe gui, final ItemStack aStack, final List currenttip, final int aRecipeIndex) { + final TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); + if ((tObject instanceof CachedDefaultRecipe)) { + final CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; + for (final PositionedStack tStack : tRecipe.mOutputs) { + if (aStack == tStack.item) { + if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { + break; + } + currenttip.add("Chance: " + (((FixedPositionedStack) tStack).mChance / 100) + "." + ((((FixedPositionedStack) tStack).mChance % 100) < 10 ? "0" + (((FixedPositionedStack) tStack).mChance % 100) : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); + break; + } + } + for (final PositionedStack tStack : tRecipe.mInputs) { + if (GT_Utility.areStacksEqual(aStack, tStack.item)) { + if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || + (tStack.item.stackSize != 0)) { + break; + } + if (ItemUtils.isControlCircuit(aStack)) { + currenttip.add("Does not get consumed in the process"); + } + break; + } + } + } + return currenttip; + } + + @Override + public void drawExtras(final int aRecipeIndex) { + final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + if (tEUt != 0) { + drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216); + //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216); + if (this.mRecipeMap.mShowVoltageAmperageInNEI) { + drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216); + drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216); + } else { + drawText(10, 93, "Voltage: unspecified", -16777216); + drawText(10, 103, "Amperage: unspecified", -16777216); + } + } + if (tDuration > 0) { + drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216); + } + //if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) { + //drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216); + //} + } + + public static class GT_RectHandler + implements IContainerInputHandler, IContainerTooltipHandler { + @Override + public boolean mouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + if (this.canHandle(gui)) { + if (button == 0) { + return this.transferRect(gui, false); + } + if (button == 1) { + return this.transferRect(gui, true); + } + } + return false; + } + + @Override + public boolean lastKeyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + public boolean canHandle(final GuiContainer gui) { + return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) /*|| ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))*/); + } + + @Override + public List handleTooltip(final GuiContainer gui, final int mousex, final int mousey, final List currenttip) { + if ((this.canHandle(gui)) && (currenttip.isEmpty())) { + if ((gui instanceof GT_GUIContainer_BasicMachine) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + currenttip.add("Recipes"); + }*/ + + } + return currenttip; + } + + private boolean transferRect(final GuiContainer gui, final boolean usage) { + if (gui instanceof GT_GUIContainer_BasicMachine) { + return (this.canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI, new Object[0])); + } /*else if (gui instanceof GT_GUIContainer_FusionReactor) { + return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0]) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI, new Object[0])); + }*/ + return false; + } + + @Override + public List handleItemDisplayName(final GuiContainer gui, final ItemStack itemstack, final List currenttip) { + return currenttip; + } + + @Override + public List handleItemTooltip(final GuiContainer gui, final ItemStack itemstack, final int mousex, final int mousey, final List currenttip) { + return currenttip; + } + + @Override + public boolean keyTyped(final GuiContainer gui, final char keyChar, final int keyCode) { + return false; + } + + @Override + public void onKeyTyped(final GuiContainer gui, final char keyChar, final int keyID) { + } + + @Override + public void onMouseClicked(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public void onMouseUp(final GuiContainer gui, final int mousex, final int mousey, final int button) { + } + + @Override + public boolean mouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + return false; + } + + @Override + public void onMouseScrolled(final GuiContainer gui, final int mousex, final int mousey, final int scrolled) { + } + + @Override + public void onMouseDragged(final GuiContainer gui, final int mousex, final int mousey, final int button, final long heldTime) { + } + } + + public class FixedPositionedStack + extends PositionedStack { + public final int mChance; + public boolean permutated = false; + + public FixedPositionedStack(final Object object, final int x, final int y) { + this(object, x, y, 0); + } + + public FixedPositionedStack(final Object object, final int x, final int y, final int aChance) { + super(object, x, y, true); + this.mChance = aChance; + } + + @Override + public void generatePermutations() { + if (this.permutated) { + return; + } + final ArrayList tDisplayStacks = new ArrayList(); + for (final ItemStack tStack : this.items) { + if (GT_Utility.isStackValid(tStack)) { + if (tStack.getItemDamage() == 32767) { + final List permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + if (!permutations.isEmpty()) { + ItemStack stack; + for (final Iterator i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, new Object[]{stack}))) { + stack = i$.next(); + } + } else { + final ItemStack base = new ItemStack(tStack.getItem(), tStack.stackSize); + base.stackTagCompound = tStack.stackTagCompound; + tDisplayStacks.add(base); + } + } else { + tDisplayStacks.add(GT_Utility.copy(new Object[]{tStack})); + } + } + } + this.items = (tDisplayStacks.toArray(new ItemStack[0])); + if (this.items.length == 0) { + this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; + } + this.permutated = true; + this.setPermutationToRender(0); + } + } + + public class CachedDefaultRecipe + extends TemplateRecipeHandler.CachedRecipe { + public final GT_Recipe mRecipe; + public final List mOutputs = new ArrayList(); + public final List mInputs = new ArrayList(); + + public CachedDefaultRecipe(final GT_Recipe aRecipe) { + super(); + this.mRecipe = aRecipe; + + int tStartIndex = 0; + + + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 5)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 12, 23)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 30, 23)); + } + tStartIndex++; + if (aRecipe.getRepresentativeInput(tStartIndex) != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 23)); + } + tStartIndex++; + + if (aRecipe.mSpecialItems != null) { + this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + } + tStartIndex = 0; + + //Four Output Slots + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 5, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + if (aRecipe.getOutput(tStartIndex) != null) { + this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 120, 23, aRecipe.getOutputChance(tStartIndex))); + } + tStartIndex++; + + if ((aRecipe.mFluidInputs.length > 0) && (aRecipe.mFluidInputs[0] != null) && (aRecipe.mFluidInputs[0].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[0], true), 30, 52)); + if ((aRecipe.mFluidInputs.length > 1) && (aRecipe.mFluidInputs[1] != null) && (aRecipe.mFluidInputs[1].getFluid() != null)) { + this.mInputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidInputs[1], true), 48, 52)); + } + } + + if (aRecipe.mFluidOutputs.length > 0) { + if ((aRecipe.mFluidOutputs[0] != null) && (aRecipe.mFluidOutputs[0].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[0], true), 102, 52)); + } + if ((aRecipe.mFluidOutputs.length > 1) && (aRecipe.mFluidOutputs[1] != null) && (aRecipe.mFluidOutputs[1].getFluid() != null)) { + this.mOutputs.add(new FixedPositionedStack(GT_Utility.getFluidDisplayStack(aRecipe.mFluidOutputs[1], true), 120, 52)); + } + } + } + + @Override + public List getIngredients() { + return this.getCycledIngredients(GT_NEI_FlotationCell.this.cycleticks / 10, this.mInputs); + } + + @Override + public PositionedStack getResult() { + return null; + } + + @Override + public List getOtherStacks() { + return this.mOutputs; + } + } +} diff --git a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java index 438ada00ba..7009058e77 100644 --- a/src/Java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/Java/gtPlusPlus/nei/NEI_GT_Config.java @@ -18,6 +18,7 @@ implements IConfigureNEI { mUniqueRecipeMapHandling.add(Gregtech_Recipe_Map.sChemicalPlantRecipes.mUnlocalizedName); mUniqueRecipeMapHandling.add(Gregtech_Recipe_Map.sOreMillRecipes.mUnlocalizedName); + mUniqueRecipeMapHandling.add(Gregtech_Recipe_Map.sFlotationCellRecipes.mUnlocalizedName); for (final CustomRecipeMap tMap : gregtech.api.util.CustomRecipeMap.sMappings) { if (tMap.mNEIAllowed) { @@ -33,6 +34,7 @@ implements IConfigureNEI { } new GT_NEI_FluidReactor(); new GT_NEI_MillingMachine(); + new GT_NEI_FlotationCell(); sIsAdded = true; API.registerRecipeHandler(new DecayableRecipeHandler()); API.registerUsageHandler(new DecayableRecipeHandler()); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java index 688433b3ac..7f2316605f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java @@ -289,5 +289,8 @@ public interface IGregtech_RecipeAdder { public boolean addMillingRecipe(Materials aMat, int aEU); public boolean addMillingRecipe(Material aMat, int aEU); + public boolean addFlotationRecipe(Materials aMat, ItemStack aXanthate, FluidStack[] aInputFluids, FluidStack[] aOutputFluids, int aTime, int aEU); + public boolean addFlotationRecipe(Material aMat, ItemStack aXanthate, FluidStack[] aInputFluids, FluidStack[] aOutputFluids, int aTime, int aEU); + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java new file mode 100644 index 0000000000..333939d800 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/helpers/FlotationRecipeHandler.java @@ -0,0 +1,79 @@ +package gtPlusPlus.xmod.gregtech.common.helpers; + +import java.util.HashMap; + +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.data.AES; +import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix; +import net.minecraft.item.ItemStack; + +public class FlotationRecipeHandler { + + private static HashMap sMaterialMap = new HashMap(); + private static HashMap sMilledMap = new HashMap(); + private static final AES sEncodingHandler = new AES(); + + public static boolean registerOreType(Material aMaterial) { + String aMaterialKey = sEncodingHandler.encode(aMaterial.getUnlocalizedName()); + if (sMaterialMap.containsKey(aMaterialKey)) { + CORE.crash("Tried to register a Flotation material to an ID already in use. ID: "+aMaterialKey); + return false; + } + else { + sMaterialMap.put(aMaterialKey, aMaterial); + sMilledMap.put(aMaterialKey, aMaterial.getMilled(1)); + } + return true; + } + + public static int getHashForMaterial(Material aMaterial) { + return getMaterialsID(aMaterial).hashCode(); + } + + public static String getMaterialsID(Material aMaterial) { + for (String aKey : sMaterialMap.keySet()) { + if (sMaterialMap.get(aKey).equals(aMaterial)) { + return aKey; + } + } + return "BAD_MATERIAL_ID"; + } + + public static Material getMaterialOfMilledProduct(ItemStack aMilled) { + for (String aKey : sMilledMap.keySet()) { + ItemStack aTempMilledStack = sMilledMap.get(aKey); + if (GT_Utility.areStacksEqual(aTempMilledStack, aMilled, true)) { + return sMaterialMap.get(aKey); + } + } + return null; + } + + public static ItemStack findMilledStack(GT_Recipe aRecipe) { + if (aRecipe == null || aRecipe.mInputs == null || aRecipe.mInputs.length <= 0) { + return null; + } + return findMilledStack(aRecipe.mInputs); + } + + public static ItemStack findMilledStack(ItemStack[] aInputs) { + if (aInputs == null || aInputs.length <= 0) { + return null; + } + for (ItemStack aStack : aInputs) { + if (CustomOrePrefix.milled.get().contains(aStack)) { + return aStack; + } + } + return null; + } + + public static AES getEncoder() { + return sEncodingHandler; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java index 77fc8d55d2..73a60889c6 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java @@ -296,6 +296,9 @@ public class GTPP_CapeRenderer extends RenderPlayer { private static final boolean init() { CapeUtils.handleOldCapeCache(); + if (CORE.DEVENV) { + return true; + } try { if (shouldDownloadCapeList()) { downloadCapeList(); @@ -418,7 +421,7 @@ public class GTPP_CapeRenderer extends RenderPlayer { } AutoMap aDecodedData = new AutoMap(); for (String aToDecode : aCacheData) { - aDecodedData.put(sAES.decrypt(aToDecode)); + aDecodedData.put(sAES.decode(aToDecode)); } if (!aDecodedData.isEmpty()) { AutoMap> aCapeType1 = new AutoMap>(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java index 6a154051d5..31c9636cac 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCuttingMachine.java @@ -1,25 +1,28 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; public class GregtechMetaTileEntity_IndustrialCuttingMachine extends GregtechMeta_MultiBlockBase { + + private boolean mCuttingMode = true; + public GregtechMetaTileEntity_IndustrialCuttingMachine(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } @@ -35,7 +38,7 @@ extends GregtechMeta_MultiBlockBase { @Override public String getMachineType() { - return "Cutting Machine"; + return "Cutting Machine / Slicing Machine"; } @Override @@ -74,7 +77,7 @@ extends GregtechMeta_MultiBlockBase { @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return GT_Recipe.GT_Recipe_Map.sCutterRecipes; + return mCuttingMode ? GT_Recipe.GT_Recipe_Map.sCutterRecipes : GT_Recipe.GT_Recipe_Map.sSlicerRecipes; } @Override @@ -202,11 +205,22 @@ extends GregtechMeta_MultiBlockBase { return (byte) TAE.GTPP_INDEX(29); } - private boolean addToMachineList(final IGregTechTileEntity tTileEntity) { - return ((this.addMaintenanceToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addInputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addOutputToMachineList(tTileEntity, this.getCasingTextureIndex())) || (this.addMufflerToMachineList(tTileEntity, this.getCasingTextureIndex()))); + @Override + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + mCuttingMode = Utils.invertBoolean(mCuttingMode); + String aMode = mCuttingMode ? "Cutting" : "Slicing"; + PlayerUtils.messagePlayer(aPlayer, "Mode: "+aMode); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("mCuttingMode", mCuttingMode); } - private boolean addEnergyInputToMachineList(final IGregTechTileEntity tTileEntity) { - return ((this.addEnergyInputToMachineList(tTileEntity, this.getCasingTextureIndex()))); + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mCuttingMode = aNBT.getBoolean("mCuttingMode"); } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java index aad16d3a56..f6cc06059b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java @@ -2,6 +2,7 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.a import java.lang.reflect.Method; +import gregtech.GT_Mod; import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; import gregtech.api.enums.TAE; @@ -25,6 +26,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_FusionComputer { @@ -282,5 +284,96 @@ public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_Fus private boolean isFusionCoil(int aX, int aY, int aZ) { return (getBaseMetaTileEntity().getBlock(aX, aY, aZ) == getFusionCoil() && (getBaseMetaTileEntity().getMetaID(aX, aY, aZ) == getFusionCoilMeta())); } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (mEfficiency < 0) + mEfficiency = 0; + if (mRunningOnLoad && checkMachine(aBaseMetaTileEntity, mInventory[1])) { + this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); + checkRecipe(mInventory[1]); + } + if (--mUpdate == 0 || --mStartUpCheck == 0) { + mInputHatches.clear(); + mInputBusses.clear(); + mOutputHatches.clear(); + mOutputBusses.clear(); + mDynamoHatches.clear(); + mEnergyHatches.clear(); + mMufflerHatches.clear(); + mMaintenanceHatches.clear(); + mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); + } + if (mStartUpCheck < 0) { + if (mMachine) { + if (this.mEnergyHatches != null) { + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) + if (isValidMetaTileEntity(tHatch)) { + long aVoltage = GT_Values.V[tHatch.mTier]; + if (aBaseMetaTileEntity.getStoredEU() + (aVoltage) < maxEUStore() + && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(aVoltage, false)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits(aVoltage, true); + } + } + } + if (this.mEUStore <= 0 && mMaxProgresstime > 0) { + stopMachine(); + } + if (getRepairStatus() > 0) { + if (mMaxProgresstime > 0) { + this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); + if (mMaxProgresstime > 0 && ++mProgresstime >= mMaxProgresstime) { + if (mOutputItems != null) + for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack); + if (mOutputFluids != null) + for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack); + mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + mOutputItems = null; + mProgresstime = 0; + mMaxProgresstime = 0; + mEfficiencyIncrease = 0; + if (mOutputFluids != null && mOutputFluids.length > 0) { + try { + GT_Mod.instance.achievements.issueAchivementHatchFluid(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), mOutputFluids[0]); + } catch (Exception e) { + } + } + this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); + if (aBaseMetaTileEntity.isAllowedToWork()) + checkRecipe(mInventory[1]); + } + } else { + if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { + turnCasingActive(mMaxProgresstime > 0); + if (aBaseMetaTileEntity.isAllowedToWork()) { + this.mEUStore = (int) aBaseMetaTileEntity.getStoredEU(); + if (checkRecipe(mInventory[1])) { + if (this.mEUStore < this.mLastRecipe.mSpecialValue) { + mMaxProgresstime = 0; + turnCasingActive(false); + } + aBaseMetaTileEntity.decreaseStoredEnergyUnits(this.mLastRecipe.mSpecialValue, true); + } + } + if (mMaxProgresstime <= 0) + mEfficiency = Math.max(0, mEfficiency - 1000); + } + } + } else { + this.mLastRecipe = null; + stopMachine(); + } + } else { + turnCasingActive(false); + this.mLastRecipe = null; + stopMachine(); + } + } + aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) + | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64)); + aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java index 74047e5ecc..1ceb6bd93f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_FrothFlotationCell.java @@ -16,26 +16,29 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.helpers.GregtechPlusPlus_API.Multiblock_API; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.minecraft.multi.SpecialMultiBehaviour; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import gtPlusPlus.xmod.gregtech.common.helpers.FlotationRecipeHandler; import gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_AlgaeFarm; import ic2.core.init.BlocksItems; import ic2.core.init.InternalName; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase { - private int mLevel = -1; - public GregtechMTE_FrothFlotationCell(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); } @@ -57,22 +60,7 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase @Override public String[] getTooltip() { return new String[] { - "Grows Algae!", - "Controller Block for the Algae Farm", - "Provide compost to boost production by one tier", - "Size: 9x3x9 [WxHxL] (open)", - "X X", - "X X", - "XXXXXXXXX", - "Machine Casings (all bottom layer)", - "Sterile Farm Casings (rest)", - "Controller (front centered)", - "All hatches must be on the bottom layer", - "All hulls must be the same tier, this dictates machine speed", - "Does not require power or maintenance", - "1x Output Bus", - "1x Input Bus (optional)", - "1x Input Hatch (fill with water)", + "Process that milled ore!", }; } @@ -84,15 +72,15 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase @Override public boolean isFacingValid(final byte aFacing) { - Logger.INFO("Facing: "+aFacing); - return aFacing == 1; + if (aFacing == 0 || aFacing > 1) { + return false; + } + return true; } @Override public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { - int aID = TAE.getIndexFromPage(2, 1); - if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[aID], new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)}; } @@ -106,12 +94,12 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return null; + return Recipe_GT.Gregtech_Recipe_Map.sFlotationCellRecipes; } @Override public int getMaxParallelRecipes() { - return 2; + return 1; } @Override @@ -121,187 +109,126 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase @Override public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - - - this.mLevel = 0; - if (this.mLevel == 0) { - return false; + Block aCasing1 = ModBlocks.blockCasings3Misc; + int aCasingMeta1 = 1; + Block aCasing2 = ModBlocks.blockSpecialMultiCasings; + int aCasingMeta2 = 9; + int aCasingCount1 = 0; + int aCasingCount2 = 0; + int aControllerY = aBaseMetaTileEntity.getYCoord(); + // Check adjacent blocks + for (byte side = 2; side < 6; side++) { + Block aBlock = aBaseMetaTileEntity.getBlockAtSide(side); + int aMeta = aBaseMetaTileEntity.getMetaIDAtSide(side); + if (this.isValidBlockForStructure(null, 0, false, aBlock, aMeta, aCasing1, aCasingMeta1)) { + aCasingCount1++; + } + else { + log("Bad block at Y:"+(aControllerY)); + return false; + } } + // Check first layer + aControllerY--; + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { - // Get Facing direction - int mCurrentDirectionX; - int mCurrentDirectionZ; - - int mOffsetX_Lower = 0; - int mOffsetX_Upper = 0; - int mOffsetZ_Lower = 0; - int mOffsetZ_Upper = 0; - - mCurrentDirectionX = 4; - mCurrentDirectionZ = 4; - - mOffsetX_Lower = -4; - mOffsetX_Upper = 4; - mOffsetZ_Lower = -4; - mOffsetZ_Upper = 4; - - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX - * mCurrentDirectionX; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ - * mCurrentDirectionZ; - - // Get Expected Tier -// Block aCasingBlock = aBaseMetaTileEntity.getBlockAtSide((byte) 3); -// int aCasingMeta = aBaseMetaTileEntity.getMetaIDAtSide((byte) 3); -// -// // Bad Casings -// if ((aCasingBlock != GregTech_API.sBlockCasings1) || aCasingMeta > 9) { -// Logger.INFO("is false"); -// return false; -// } -// else { - mLevel = this.getCasingTier(); - //} - int aID = TAE.getIndexFromPage(1, 15); - int tAmount = 0; - check : for (int i = mOffsetX_Lower; i <= mOffsetX_Upper; ++i) { - for (int j = mOffsetZ_Lower; j <= mOffsetZ_Upper; ++j) { - for (int h = -1; h < 2; ++h) { - if ((h != 0) || ((((xDir + i != 0) || (zDir + j != 0))) && (((i != 0) || (j != 0))))) { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j); - - Logger.INFO("X: " + i + " | Z: " + j+" | Tier: "+aID); - if (h == -1 && tTileEntity != null && addToMachineList(tTileEntity, aID)) { - continue; - } - else if (h != -1 && tTileEntity != null) { - Logger.INFO("Found hatch in wrong place, expected casing."); - return false; - } - - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); + int aWorldOffsetX = aBaseMetaTileEntity.getXCoord() + x; + int aWorldOffsetZ = aBaseMetaTileEntity.getZCoord() + z; - if ((h >= 0) && (tBlock == ModBlocks.blockCasings2Misc) && (tMeta == 15) ) { - ++tAmount; - } - else if ((h == -1) && (tBlock == GregTech_API.sBlockCasings1) && (tMeta == mLevel) ) { - ++tAmount; - } - else if ((h == -1) && (tBlock == GregTech_API.sBlockCasings1) && (tMeta != mLevel) ) { - Logger.INFO("Found wrong tiered casing."); - return false; + // Don't check air + if ((x == -2 && z != 0) || (x == 2 && z != 0) || (z == -2 && x != 0) || (z == 2 && x != 0) || (x == 0 && z == 0)) { + continue; + } + else { + Block aBlock = aBaseMetaTileEntity.getBlock(aWorldOffsetX, aControllerY, aWorldOffsetZ); + int aMeta = aBaseMetaTileEntity.getMetaID(aWorldOffsetX, aControllerY, aWorldOffsetZ); + if (this.isValidBlockForStructure(null, 0, false, aBlock, aMeta, aCasing2, aCasingMeta2)) { + aCasingCount2++; + } + else { + log("Bad block at Y:"+(aControllerY)+", X:"+aWorldOffsetX+", Z:"+aWorldOffsetZ); + aBaseMetaTileEntity.getWorld().setBlock(aWorldOffsetX, aControllerY, aWorldOffsetZ, Blocks.bookshelf); + return false; + } + } + } + } + // Check circular tower + aControllerY--; + for (int y = aControllerY; y > (aControllerY-5); y--) { + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { + + int aWorldOffsetX = aBaseMetaTileEntity.getXCoord() + x; + int aWorldOffsetZ = aBaseMetaTileEntity.getZCoord() + z; + + // Don't check air + if ((x == -2 && z != 0) || (x == 2 && z != 0) || (z == -2 && x != 0) || (z == 2 && x != 0) || (x == 0 && z == 0)) { + continue; + } + // Don't check air + else if ((x == -1 && z == 0) || (x == 1 && z == 0) || (z == -1 && x == 0) || (z == 1 && x == 0) || (x == 0 && z == 0)) { + continue; + } + else { + Block aBlock = aBaseMetaTileEntity.getBlock(aWorldOffsetX, y, aWorldOffsetZ); + int aMeta = aBaseMetaTileEntity.getMetaID(aWorldOffsetX, y, aWorldOffsetZ); + if (this.isValidBlockForStructure(null, 0, false, aBlock, aMeta, aCasing2, aCasingMeta2)) { + aCasingCount2++; } else { - if ((i != mOffsetX_Lower && j != mOffsetZ_Lower && i != mOffsetX_Upper - && j != mOffsetZ_Upper) && (h == 0 || h == 1)) { - continue; - } else { - if (tBlock.getLocalizedName().contains("gt.blockmachines") || tBlock == Blocks.water - || tBlock == Blocks.flowing_water - || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) { - continue; - - } else { - Logger.INFO("[x] Did not form - Found: " + tBlock.getLocalizedName() + " | " - + tBlock.getDamageValue(aBaseMetaTileEntity.getWorld(), - aBaseMetaTileEntity.getXCoord() + i, - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord() + j) - + " | Special Meta: " - + (tTileEntity == null ? "0" : tTileEntity.getMetaTileID())); - Logger.INFO("[x] Did not form - Found: " - + (aBaseMetaTileEntity.getXCoord() + xDir + i) + " | " - + aBaseMetaTileEntity.getYCoord() + " | " - + (aBaseMetaTileEntity.getZCoord() + zDir + j)); - break check; - } - } - + log("Bad block at Y:"+(y)+", X:"+aWorldOffsetX+", Z:"+aWorldOffsetZ); + return false; } - - } - } + } + } } } - if ((tAmount >= 64)) { - Logger.INFO("Made structure."); - this.getBaseMetaTileEntity().getWorld().markBlockForUpdate(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()); - } else { - Logger.INFO("Did not make structure."); - } - return (tAmount >= 64); - } - - public boolean checkForWater() { - - // Get Facing direction - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - int mDirectionX = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int mCurrentDirectionX; - int mCurrentDirectionZ; - int mOffsetX_Lower = 0; - int mOffsetX_Upper = 0; - int mOffsetZ_Lower = 0; - int mOffsetZ_Upper = 0; - - mCurrentDirectionX = 4; - mCurrentDirectionZ = 4; - - mOffsetX_Lower = -4; - mOffsetX_Upper = 4; - mOffsetZ_Lower = -4; - mOffsetZ_Upper = 4; - - // if (aBaseMetaTileEntity.fac) - - final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX - * mCurrentDirectionX; - final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ - * mCurrentDirectionZ; - - int tAmount = 0; - for (int i = mOffsetX_Lower + 1; i <= mOffsetX_Upper - 1; ++i) { - for (int j = mOffsetZ_Lower + 1; j <= mOffsetZ_Upper - 1; ++j) { - for (int h = 0; h < 2; h++) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - // byte tMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j); - if (tBlock == Blocks.air || tBlock == Blocks.flowing_water || tBlock == BlocksItems.getFluidBlock(InternalName.fluidDistilledWater)) { - if (this.getStoredFluids() != null) { - for (FluidStack stored : this.getStoredFluids()) { - if (stored.isFluidEqual(FluidUtils.getFluidStack("water", 1))) { - if (stored.amount >= 1000) { - // Utils.LOG_WARNING("Going to try swap an air block for water from inut bus."); - stored.amount -= 1000; - Block fluidUsed = Blocks.water; - aBaseMetaTileEntity.getWorld().setBlock( - aBaseMetaTileEntity.getXCoord() + xDir + i, - aBaseMetaTileEntity.getYCoord() + h, - aBaseMetaTileEntity.getZCoord() + zDir + j, fluidUsed); - - } - } + // Check Base + aControllerY -= 5; + for (int y = aControllerY; y > (aControllerY-2); y--) { + for (int x = -3; x < 4; x++) { + for (int z = -3; z < 4; z++) { + int aWorldOffsetX = aBaseMetaTileEntity.getXCoord() + x; + int aWorldOffsetZ = aBaseMetaTileEntity.getZCoord() + z; + if ((x == -3 && z == -3) || (x == 3 && z == 3) || (x == -3 && z == 3) || (x == 3 && z == -3)) { + continue; + } + else if ((x == -3 && z == -2) || (x == -2 && z == -3) || (x == 3 && z == 2) || (x == 2 && z == 3)) { + continue; + } + else if ((x == -2 && z == 3) || (x == -3 && z == 2) || (x == 3 && z == -2) || (x == 2 && z == -3)) { + continue; + } + else { + Block aBlock = aBaseMetaTileEntity.getBlock(aWorldOffsetX, y, aWorldOffsetZ); + int aMeta = aBaseMetaTileEntity.getMetaID(aWorldOffsetX, y, aWorldOffsetZ); + IGregTechTileEntity aTile = aBaseMetaTileEntity.getIGregTechTileEntity(aWorldOffsetX, y, aWorldOffsetZ); + if (this.isValidBlockForStructure(aTile, TAE.getIndexFromPage(2, 1), true, aBlock, aMeta, aCasing1, aCasingMeta1)) { + if (aTile == null) { + aCasingCount1++; } } - } - tBlock = aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j); - if (tBlock == Blocks.water || tBlock == Blocks.flowing_water) { - ++tAmount; - // Logger.INFO("Found Water"); - } - } + else { + log("Bad block at Y:"+(y)+", X:"+aWorldOffsetX+", Z:"+aWorldOffsetZ); + return false; + } + } + } } } - - boolean isValidWater = tAmount >= 60; - - if (isValidWater) { - Logger.INFO("Filled structure."); - return true; - } - else { + if (aCasingCount1 < 68) { + log("Inconel Casings found: "+aCasingCount1); + log("Inconel Casings required: 68"); return false; } + if (aCasingCount2 < 52) { + log("Flotation Casings found: "+aCasingCount2); + log("Flotation Casings required: 52"); + return false; + } + return true; } @Override @@ -336,34 +263,24 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPreTick(aBaseMetaTileEntity, aTick); - this.fixAllMaintenanceIssue(); - // Silly Client Syncing - if (aBaseMetaTileEntity.isClientSide()) { - this.mLevel = getCasingTier(); + super.onPreTick(aBaseMetaTileEntity, aTick); + // Fix GT bug + if (this.getBaseMetaTileEntity().getFrontFacing() == 0 && this.getBaseMetaTileEntity().getBackFacing() == 1) { + log("Fixing Bad Facing. (GT Bug)"); + this.getBaseMetaTileEntity().setFrontFacing((byte) 1); } - } @Override - public boolean checkRecipe(final ItemStack aStack) { - return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0); + public boolean checkRecipe(ItemStack arg0) { + return super.checkRecipeGeneric(); } - + public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { - - if (this.mLevel < 0) { - Logger.INFO("Bad Tier."); - return false; - } - - if (!checkForWater()) { - Logger.INFO("Not enough Water."); - return false; - } + // Based on the Processing Array. A bit overkill, but very flexible. // Reset outputs and progress stats this.mEUt = 0; @@ -371,35 +288,111 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase this.mOutputItems = new ItemStack[]{}; this.mOutputFluids = new FluidStack[]{}; - Logger.INFO("Running checkRecipeGeneric(0)"); - - GT_Recipe tRecipe = RecipeLoader_AlgaeFarm.getTieredRecipeFromCache(this.mLevel, isUsingCompost(aItemInputs)); - + long tVoltage = getMaxInputVoltage(); + byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + long tEnergy = getMaxInputEnergy(); + log("Running checkRecipeGeneric(0)"); + + GT_Recipe tRecipe = findRecipe( + getBaseMetaTileEntity(), mLastRecipe, false, + gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + + log("Running checkRecipeGeneric(1)"); + // Remember last recipe - an optimization for findRecipe() this.mLastRecipe = tRecipe; if (tRecipe == null) { + log("BAD RETURN - 1"); return false; } - + + /* + * + * Material Hash checks + * Makes sure we can only ever use one type of material in this flotation cell. + * + */ + int aExpectedMaterialHash; + // Set the hash of expected material type + if (mLockedOreType == -1) { + mLockedOreType = FlotationRecipeHandler.getHashForMaterial(FlotationRecipeHandler.getMaterialOfMilledProduct(FlotationRecipeHandler.findMilledStack(aRecipe))); + } + // Set the hash for this recipe check + aExpectedMaterialHash = mLockedOreType; + + // Compute hash of current inputs + int aFoundMaterialHash = FlotationRecipeHandler.getHashForMaterial(FlotationRecipeHandler.getMaterialOfMilledProduct(FlotationRecipeHandler.findMilledStack(aItemInputs))); + + // Check hashes match + if (aExpectedMaterialHash != aFoundMaterialHash) { + log("Did not find the correct milled type."); + log("Found: "+aFoundMaterialHash); + log("Expected: "+mLockedOreType); + return false; + } + aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes); if (aMaxParallelRecipes == 0) { + log("BAD RETURN - 2"); return false; } - if (tRecipe.mInputs.length > 0) { - for (ItemStack aInputToConsume : tRecipe.mInputs) { - this.depleteInput(aInputToConsume); + + // EU discount + float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + float tTotalEUt = 0.0f; + + int parallelRecipes = 0; + + log("parallelRecipes: "+parallelRecipes); + log("aMaxParallelRecipes: "+aMaxParallelRecipes); + log("tTotalEUt: "+tTotalEUt); + log("tVoltage: "+tVoltage); + log("tRecipeEUt: "+tRecipeEUt); + // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) { + if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { + log("Broke at "+parallelRecipes+"."); + break; } + log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); + tTotalEUt += tRecipeEUt; } + if (parallelRecipes == 0) { + log("BAD RETURN - 3"); + return false; + } // -- Try not to fail after this point - inputs have already been consumed! -- - this.mMaxProgresstime = (int)(tRecipe.mDuration); - this.mEUt = 0; + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor); + + this.mEUt = (int)Math.ceil(tTotalEUt); + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - Logger.INFO("Recipe time: "+this.mMaxProgresstime); + this.mEfficiencyIncrease = 10000; + + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); // Collect fluid outputs @@ -407,7 +400,7 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { if (tRecipe.getFluidOutput(h) != null) { tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); - tOutputFluids[h].amount *= aMaxParallelRecipes; + tOutputFluids[h].amount *= parallelRecipes; } } @@ -423,7 +416,7 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase // Set output item stack sizes (taking output chance into account) for (int f = 0; f < tOutputItems.length; f++) { if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { - for (int g = 0; g < aMaxParallelRecipes; g++) { + for (int g = 0; g < parallelRecipes; g++) { if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; } @@ -464,50 +457,36 @@ public class GregtechMTE_FrothFlotationCell extends GregtechMeta_MultiBlockBase // Play sounds (GT++ addition - GT multiblocks play no sounds) startProcess(); - Logger.INFO("GOOD RETURN - 1"); + log("GOOD RETURN - 1"); return true; - } + + /* + * Handle NBT + */ - private boolean isUsingCompost(ItemStack[] aItemInputs) { - ItemStack aCompost = ItemUtils.getSimpleStack(AgriculturalChem.mCompost, 1); - for (ItemStack i : aItemInputs) { - if (GT_Utility.areStacksEqual(aCompost, i)) { - if (i.stackSize >= 8) { - return true; - } - else { - continue; - } - } + private int mLockedOreType = -1; + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + if (mLockedOreType != -1) { + aNBT.setInteger("mLockedOreType", mLockedOreType); } - return false; + super.setItemNBT(aNBT); } - - private final int getCasingTier() { - if (this == null || this.getBaseMetaTileEntity().getWorld() == null) { - return 0; - } - try { - Block aInitStructureCheck; - int aInitStructureCheckMeta; - IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - aInitStructureCheck = aBaseMetaTileEntity.getBlockOffset(xDir, -1, zDir); - aInitStructureCheckMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir, -1, zDir); - if (aInitStructureCheck == GregTech_API.sBlockCasings1) { - return aInitStructureCheckMeta; - } - return 0; - } - catch (Throwable t) { - t.printStackTrace(); - return 0; + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + if (mLockedOreType != -1) { + aNBT.setInteger("mLockedOreType", mLockedOreType); } } - - + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mLockedOreType = aNBT.getInteger("mLockedOreType"); + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index cc3130af98..d56e7e5cf5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -11,14 +11,8 @@ import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.interfaces.internal.IGT_RecipeAdder; -import gregtech.api.util.CustomRecipeMap; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Recipe; +import gregtech.api.util.*; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.Recipe_GT; -import gregtech.api.util.SemiFluidFuelHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; @@ -33,6 +27,7 @@ import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import gtPlusPlus.xmod.gregtech.common.helpers.FlotationRecipeHandler; import gtPlusPlus.xmod.gregtech.recipes.machines.RECIPEHANDLER_MatterFabricator; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -1323,9 +1318,9 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { ItemStack aCrushedStack = aMat.getCrushed(16); ItemStack aMilledStackOres1 = aMat.getMilled(64); - ItemStack aMilledStackCrushed1 = aMat.getMilled(48); + ItemStack aMilledStackCrushed1 = aMat.getMilled(32); ItemStack aMilledStackOres2 = aMat.getMilled(48); - ItemStack aMilledStackCrushed2 = aMat.getMilled(32); + ItemStack aMilledStackCrushed2 = aMat.getMilled(16); ItemStack aMillingBall_Alumina = GregtechItemList.Milling_Ball_Alumina.get(0); ItemStack aMillingBall_Soapstone = GregtechItemList.Milling_Ball_Soapstone.get(0); @@ -1398,6 +1393,46 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { return aSize > aSize2; } + @Override + public boolean addFlotationRecipe(Materials aMat, ItemStack aXanthate, FluidStack[] aInputFluids, FluidStack[] aOutputFluids, int aTime, int aEU) { + return addFlotationRecipe(MaterialUtils.generateMaterialFromGtENUM(aMat), aXanthate, aInputFluids, aOutputFluids, aTime, aEU); + } + + @Override + public boolean addFlotationRecipe(Material aMat, ItemStack aXanthate, FluidStack[] aInputFluids, FluidStack[] aOutputFluids, int aTime, int aEU) { + + FlotationRecipeHandler.registerOreType(aMat); + int aSpecialValue = FlotationRecipeHandler.getHashForMaterial(aMat); + + int aSize = Recipe_GT.Gregtech_Recipe_Map.sFlotationCellRecipes.mRecipeList.size(); + int aSize2 = aSize; + + GT_Recipe aRecipe = new Recipe_GT( + false, + new ItemStack[] { + ItemUtils.getSimpleStack(aXanthate, 32), + aMat.getMilled(64), + aMat.getMilled(64), + aMat.getMilled(64), + aMat.getMilled(64), + }, + new ItemStack[] { + + }, + null, + new int[] {}, + aInputFluids, + aOutputFluids, + aTime, + aEU, + aSpecialValue); + + Recipe_GT.Gregtech_Recipe_Map.sFlotationCellRecipes.add(aRecipe); + aSize = Recipe_GT.Gregtech_Recipe_Map.sFlotationCellRecipes.mRecipeList.size(); + + return aSize > aSize2; + } + -- cgit