diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-05 17:56:23 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-05 17:56:23 +0000 |
commit | 1ffbfdf48d9c23712932f6d25f1bc1529202412e (patch) | |
tree | c39cc1c9b5bed7c016c5831ecbc5e61209e315dc /src/main | |
parent | a028cc1467cdeff4d7f47734fb8557fd5239abc7 (diff) | |
download | GT5-Unofficial-1ffbfdf48d9c23712932f6d25f1bc1529202412e.tar.gz GT5-Unofficial-1ffbfdf48d9c23712932f6d25f1bc1529202412e.tar.bz2 GT5-Unofficial-1ffbfdf48d9c23712932f6d25f1bc1529202412e.zip |
Added Solar Tower & Solar Heater.
Added Potassium Nitrate.
Added Sodium Nitrate.
Added Hot/Cold Solar Salt.
Added recipes for the above.
Added Solar Salt processing to Thermal Boiler.
Re-added Assembly Line MKII, Tesla Tower. (WIP)
Diffstat (limited to 'src/main')
21 files changed, 1264 insertions, 939 deletions
diff --git a/src/main/java/gregtech/api/util/GTPP_Recipe.java b/src/main/java/gregtech/api/util/GTPP_Recipe.java index c22341856d..8fde47ad80 100644 --- a/src/main/java/gregtech/api/util/GTPP_Recipe.java +++ b/src/main/java/gregtech/api/util/GTPP_Recipe.java @@ -4,7 +4,11 @@ import static gregtech.api.enums.GT_Values.E; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; import static gregtech.api.enums.GT_Values.W; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; import codechicken.nei.PositionedStack; import gregtech.api.GregTech_API; @@ -14,7 +18,6 @@ import gregtech.api.objects.GT_ItemStack; import gtPlusPlus.api.interfaces.IComparableRecipe; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.api.objects.minecraft.NoConflictGTRecipeMap; import gtPlusPlus.core.lib.CORE; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -338,7 +341,7 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { public static final GTPP_Recipe_Map_Internal sChemicalDehydratorRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(200), "gtpp.recipe.chemicaldehydrator", "Dehydrator", null, RES_PATH_GUI + "basicmachines/Dehydrator", 2, 9, 0, 0, 1, E, 1, E, true, true); public static final GTPP_Recipe_Map_Internal sVacuumFurnaceRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(500), "gtpp.recipe.vacfurnace", "Vacuum Furnace", null, "gregtech:textures/gui/basicmachines/Default", 6, 6, 1, 0, 1, "Heat Capacity: ", 1, " K", false, true); public static final GTPP_Recipe_Map_Internal sAlloyBlastSmelterRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(200), "gtpp.recipe.alloyblastsmelter", "Alloy Blast Smelter", null, RES_PATH_GUI + "basicmachines/BlastSmelter", 9, 9, 1, 0, 1, E, 1, E, true, true); - public static final GTPP_Recipe_Map_Internal sSteamTurbineFuels = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(10), "gtpp.recipe.steamturbinefuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, true); + public static final GTPP_Recipe_Map_Internal sSteamTurbineFuels = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(10), "gtpp.recipe.steamturbinefuel", "GeoThermal Fuel", null, RES_PATH_GUI + "basicmachines/Default", 1, 1, 0, 0, 1, "Fuel Value: ", 1000, " EU", true, false); //LFTR recipes public static final GTPP_Recipe_Map_Internal sLiquidFluorineThoriumReactorRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(50), "gtpp.recipe.lftr", "Liquid Fluoride Thorium Reactor", null, RES_PATH_GUI + "basicmachines/FissionFuel", 0, 0, 0, 2, 0, "Power: ", 1, " EU/t per Dynamo", true, true); @@ -390,8 +393,13 @@ public class GTPP_Recipe extends GT_Recipe implements IComparableRecipe { //Thermal Boiler map public static final GT_Recipe.GT_Recipe_Map_Fuel sThermalFuels = new GT_Recipe_Map_Fuel(new HashSet<GT_Recipe>(10), "gtpp.recipe.thermalgeneratorfuel", "Thermal Generator Fuel", null, "gregtech:textures/gui/basicmachines/Default", 1, 1, 0, 0, 1, - "Fuel Value: ", 1000, " EU", true, false); + null, 1000, null, true, false); + //Solar Tower map + public static final GT_Recipe.GT_Recipe_Map_Fuel sSolarTowerRecipes = new GT_Recipe_Map_Fuel(new HashSet<GT_Recipe>(10), "gtpp.recipe.solartower", + "Solar Tower", null, "gregtech:textures/gui/basicmachines/Default", 1, 1, 0, 0, 1, + null, 1000, null, true, false); + //Cyclotron recipe map public static final GTPP_Recipe_Map_Internal sCyclotronRecipes = new GTPP_Recipe_Map_Internal(new HashSet<GT_Recipe>(200), "gtpp.recipe.cyclotron", "COMET - Compact Cyclotron", null, RES_PATH_GUI + "basicmachines/BlastSmelter", 2, 16, 0, 0, 1, E, 1, E, true, true); diff --git a/src/main/java/gregtech/api/util/HotFuel.java b/src/main/java/gregtech/api/util/HotFuel.java index c9a6dcf7c5..e709926f83 100644 --- a/src/main/java/gregtech/api/util/HotFuel.java +++ b/src/main/java/gregtech/api/util/HotFuel.java @@ -22,7 +22,21 @@ public class HotFuel { GTPP_Recipe.GTPP_Recipe_Map.sThermalFuels.addRecipe(x); } - + public static void addNewHotFuel(FluidStack aInput1, FluidStack aOutput1, FluidStack aOutput2, int aSpecialValue) { + GTPP_Recipe x = new GTPP_Recipe( + false, + null, + null, + null, + null, + new FluidStack[]{aInput1}, + new FluidStack[]{aOutput1, aOutput2}, + 20, //1 Second + 0, //No Eu produced + aSpecialValue //Magic Number + ); + GTPP_Recipe.GTPP_Recipe_Map.sThermalFuels.addRecipe(x); + } } diff --git a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 3460d207b4..b55001f1c2 100644 --- a/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/main/java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -135,7 +135,7 @@ public class COMPAT_HANDLER { GregtechIndustrialCuttingFactory.run(); //GregtechMiniRaFusion.run(); GregtechComponentAssembler.run(); - //GregtechTeslaTower.run(); + GregtechTeslaTower.run(); GregtechSuperChests.run(); GregtechIndustrialFishPond.run(); GregtechTieredChunkloaders.run(); @@ -151,7 +151,7 @@ public class COMPAT_HANDLER { GregtechCustomHatches.run(); //GregtechNaqReactor.run(); GregtechIndustrialArcFurnace.run(); - //GregtechSolarTower.run(); + GregtechSolarTower.run(); GregtechLargeTurbinesAndHeatExchanger.run(); GregtechPowerBreakers.run(); GregtechFluidReactor.run(); @@ -161,7 +161,7 @@ public class COMPAT_HANDLER { GregtechSteamMultis.run(); GregtechIndustrialForgeHammer.run(); GregtechMolecularTransformer.run(); - //GregtechIndustrialElementDuplicator.run(); + GregtechIndustrialElementDuplicator.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemAreaClear.java b/src/main/java/gtPlusPlus/core/item/general/ItemAreaClear.java index 5be184b3db..16d0c0253b 100644 --- a/src/main/java/gtPlusPlus/core/item/general/ItemAreaClear.java +++ b/src/main/java/gtPlusPlus/core/item/general/ItemAreaClear.java @@ -30,7 +30,7 @@ public class ItemAreaClear extends CoreItem { public IIcon[] mIcon = new IIcon[1]; public ItemAreaClear() { - super("itemDebugClearing", AddToCreativeTab.tabMachines, 1, 100, new String[] {EnumChatFormatting.OBFUSCATED+"F A M C Y N A M E"}, EnumRarity.rare, + super("itemDebugClearing", AddToCreativeTab.tabMachines, 1, 100, new String[] {EnumChatFormatting.OBFUSCATED+"F A N C Y N A M E"}, EnumRarity.rare, EnumChatFormatting.BOLD, false, null); } @@ -160,16 +160,16 @@ public class ItemAreaClear extends CoreItem { int y1 = pos.yPos; int z1 = pos.zPos; - int x2 = (x1-10); + int x2 = (x1-15); int y2 = (y1-1); - int z2 = (z1-10); + int z2 = (z1-15); fillBlockColumn(world, new BlockPos(x2, y2, z2, world)); return true; } public boolean fillBlockColumn(World world, BlockPos pos){ - for (int i=0; i<21; i++){ + for (int i=0; i<30; i++){ fillBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i, world)); } return true; @@ -177,9 +177,10 @@ public class ItemAreaClear extends CoreItem { public boolean fillBlockRow(World world, BlockPos pos){ for (int j=0; j<2; j++){ - for (int i=0; i<21; i++){ + for (int i=0; i<30; i++){ if (world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.bedrock){ - world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.grass); + world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.dirt); + world.setBlockMetadataWithNotify(pos.xPos+i, pos.yPos+j, pos.zPos, 2, 2); } } } diff --git a/src/main/java/gtPlusPlus/core/material/MISC_MATERIALS.java b/src/main/java/gtPlusPlus/core/material/MISC_MATERIALS.java index 19e8499f02..47ac6b170e 100644 --- a/src/main/java/gtPlusPlus/core/material/MISC_MATERIALS.java +++ b/src/main/java/gtPlusPlus/core/material/MISC_MATERIALS.java @@ -15,11 +15,82 @@ public final class MISC_MATERIALS { */ public static void run() { + MaterialUtils.generateSpecialDustAndAssignToAMaterial(POTASSIUM_NITRATE, false); + MaterialUtils.generateSpecialDustAndAssignToAMaterial(SODIUM_NITRATE, false); MaterialUtils.generateSpecialDustAndAssignToAMaterial(STRONTIUM_OXIDE, false); MaterialUtils.generateSpecialDustAndAssignToAMaterial(STRONTIUM_HYDROXIDE, false); WATER.registerComponentForMaterial(FluidUtils.getWater(1000)); } + public static final Material POTASSIUM_NITRATE = new Material( + "Potassium Nitrate", + MaterialState.SOLID, //State + null, + null, + -1, + -1, + -1, + -1, + false, + "KNO3", + 0, + false, + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().POTASSIUM, 1), + new MaterialStack(ELEMENT.getInstance().NITROGEN, 1), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 3) + }); + public static final Material SODIUM_NITRATE = new Material( + "Sodium Nitrate", + MaterialState.SOLID, //State + null, + null, + -1, + -1, + -1, + -1, + false, + "NaNO3", + 0, + false, + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().SODIUM, 1), + new MaterialStack(ELEMENT.getInstance().NITROGEN, 1), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 3) + }); + + public static final Material SOLAR_SALT_COLD = new Material( + "Solar Salt (Cold)", + MaterialState.PURE_LIQUID, //State + null, //Material Colour + -1, //Melting Point in C + -1, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(POTASSIUM_NITRATE, 4), + new MaterialStack(SODIUM_NITRATE, 6) + }); + + public static final Material SOLAR_SALT_HOT = new Material( + "Solar Salt (Hot)", + MaterialState.PURE_LIQUID, //State + new short[] {200, 25, 25}, //Material Colour + 1200, //Melting Point in C + 3300, //Boiling Point in C + -1, //Protons + -1, + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(POTASSIUM_NITRATE, 4), + new MaterialStack(SODIUM_NITRATE, 6) + }); + + + public static final Material STRONTIUM_OXIDE = new Material( "Strontium Oxide", MaterialState.SOLID, diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 3d0e6aebfd..adf93c0f69 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -1700,7 +1700,7 @@ public class RECIPES_GREGTECH { GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketHootch", 0, 1), null, 36, 0); } - HotFuel.addNewHotFuel(GT_ModHandler.getLava(83), GT_Values.NF, + HotFuel.addNewHotFuel(FluidUtils.getLava(83), FluidUtils.getPahoehoeLava(83), new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("nuggetCopper", 1), ItemUtils.getItemStackOfAmountFromOreDict("nuggetTin", 1), ItemUtils.getItemStackOfAmountFromOreDict("nuggetGold", 1), @@ -1710,7 +1710,7 @@ public class RECIPES_GREGTECH { ItemUtils.getSimpleStack(Blocks.obsidian) }, new int[] { 2000, 1000, 250, 250, 250, 250, 500 }, 0); - HotFuel.addNewHotFuel(FluidUtils.getFluidStack("ic2pahoehoelava", 83), GT_Values.NF, + HotFuel.addNewHotFuel(FluidUtils.getPahoehoeLava(83), GT_Values.NF, new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("nuggetBronze", 1), ItemUtils.getItemStackOfAmountFromOreDict("nuggetElectrum", 1), @@ -1718,6 +1718,12 @@ public class RECIPES_GREGTECH { ItemUtils.getItemStackOfAmountFromOreDict("dustSmallTungstate", 1), ItemUtils.getSimpleStack(Blocks.obsidian) }, new int[] { 750, 250, 250, 250, 1850 }, 0); + + HotFuel.addNewHotFuel( + MISC_MATERIALS.SOLAR_SALT_HOT.getFluidStack(1000), + MISC_MATERIALS.SOLAR_SALT_COLD.getFluidStack(1000), + FluidUtils.getSuperHeatedSteam(10000), + 0); /* * HotFuel.addNewHotFuel( FluidUtils.getFluidStack("ic2hotcoolant", @@ -1754,6 +1760,21 @@ public class RECIPES_GREGTECH { private static void centrifugeRecipes() { + GT_Values.RA.addCentrifugeRecipe( + CI.getNumberedAdvancedCircuit(2), + MISC_MATERIALS.SOLAR_SALT_COLD.getCell(10), + null, + null, + MISC_MATERIALS.SODIUM_NITRATE.getDust(6), + MISC_MATERIALS.POTASSIUM_NITRATE.getDust(4), + CI.emptyCells(10), + null, + null, + null, + null, + 20 * 30, + 120); + } private static void mixerRecipes() { @@ -1769,6 +1790,19 @@ public class RECIPES_GREGTECH { 600, 60); + GT_Values.RA.addMixerRecipe( + CI.getNumberedAdvancedCircuit(2), + CI.emptyCells(10), + MISC_MATERIALS.SODIUM_NITRATE.getDust(6), + MISC_MATERIALS.POTASSIUM_NITRATE.getDust(4), + null, + null, + MISC_MATERIALS.SOLAR_SALT_COLD.getCell(10), + 20 * 10, + 120); + + + } private static void chemicalReactorRecipes() { @@ -1796,7 +1830,26 @@ public class RECIPES_GREGTECH { FluidUtils.getFluidStack("sulfuricacid", 4000), FluidUtils.getFluidStack("sulfuricapatite", 8000), ItemUtils.getItemStackOfAmountFromOreDict("dustSmallSulfur", 8), - 20 * 20); + 20 * 20); + + GT_Values.RA.addChemicalRecipe( + Materials.Potassium.getDust(1), + CI.getNumberedAdvancedCircuit(1), + Materials.NitricAcid.getFluid(1000), + GT_Values.NF, + MISC_MATERIALS.POTASSIUM_NITRATE.getDust(1), + 100, + 30); + + GT_Values.RA.addChemicalRecipe( + ItemUtils.getSimpleStack(AgriculturalChem.mSodiumCarbonate, 1), + CI.getNumberedAdvancedCircuit(1), + Materials.NitricAcid.getFluid(1000), + GT_Values.NF, + MISC_MATERIALS.SODIUM_NITRATE.getDust(1), + 100, + 30); + } diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_General.java index 1c95467770..caafbccf29 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_General.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_General.java @@ -17,6 +17,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.*; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; @@ -28,6 +29,7 @@ import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; public class RECIPES_General { @@ -110,6 +112,25 @@ public class RECIPES_General { } + if (OreDictionary.doesOreNameExist("dustPotassiumNitrade")) { + ItemStack aDustKNO3 = ItemUtils.getItemStackOfAmountFromOreDict("dustPotassiumNitrade", 1); + ItemStack aDustGtppKNO3 = MISC_MATERIALS.POTASSIUM_NITRATE.getDust(1); + if (RecipeUtils.addShapedRecipe( + null, null, null, + null, "dustPotassiumNitrade", null, + null, null, null, + ItemUtils.getSimpleStack(aDustGtppKNO3, 1))) { + Logger.INFO("Add conversion recipe (GT Potassium Nitrade -> GT++ Potassium Nitrate)"); + } + if (RecipeUtils.addShapedRecipe( + null, null, null, + null, "dustPotassiumNitrate", null, + null, null, null, + ItemUtils.getSimpleStack(aDustKNO3, 1))) { + Logger.INFO("Add conversion recipe (GT++ Potassium Nitrate -> GT Potassium Nitrade)"); + } + } + //Rainforest oak Sapling if (RecipeUtils.addShapedRecipe( "stickWood", "stickWood", "stickWood", diff --git a/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java new file mode 100644 index 0000000000..e5666d84b4 --- /dev/null +++ b/src/main/java/gtPlusPlus/nei/GT_NEI_MultiSolarTower.java @@ -0,0 +1,36 @@ +package gtPlusPlus.nei; + +import static gregtech.api.enums.GT_Values.RES_PATH_GUI; + +import codechicken.nei.recipe.TemplateRecipeHandler; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.core.util.math.MathUtils; + +public class GT_NEI_MultiSolarTower extends GT_NEI_MultiNoCell { + + public GT_NEI_MultiSolarTower(GT_Recipe_Map aMap) { + super(aMap); + } + + @Override + public TemplateRecipeHandler newInstance() { + return new GT_NEI_MultiSolarTower(mRecipeMap); + } + + @Override + public String getGuiTexture() { + return RES_PATH_GUI + "basicmachines/FissionFuel.png"; + } + + @Override + public void drawExtras(final int aRecipeIndex) { + final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; + if (tDuration > 0) { + drawText(10, 90, "Time: " + (tDuration < 20 ? "< 1" : MathUtils.formatNumbers(Integer.valueOf(tDuration / 20))) + " secs", -16777216); + } + drawText(5, 100, "Solar Heater rings boost tier", -16777216); + drawText(5, 110, "R1:T1, R2:T2, R3:T4, R4:T8, R5:T16", -16777216); + drawText(5, 120, "Input Amount = 1000 x T", -16777216); + } + +} diff --git a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java index c566301e4e..3686cd5dba 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java +++ b/src/main/java/gtPlusPlus/nei/NEI_GT_Config.java @@ -33,6 +33,8 @@ implements IConfigureNEI { mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockElectrolyzerRecipes_GT.mUnlocalizedName); mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sMultiblockMixerRecipes_GT.mUnlocalizedName); mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sAlloyBlastSmelterRecipes.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sThermalFuels.mUnlocalizedName); + mUniqueRecipeMapHandling.add(GTPP_Recipe_Map.sSolarTowerRecipes.mUnlocalizedName); // Standard GT Recipe Maps Logger.INFO("NEI Registration: "+GTPP_Recipe_Map_Internal.sMappingsEx.size()+" sMappingEx"); @@ -65,6 +67,10 @@ implements IConfigureNEI { new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sFissionFuelProcessing); Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sVacuumFurnaceRecipes.mNEIName); new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sVacuumFurnaceRecipes); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sThermalFuels.mNEIName); + new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sThermalFuels); + Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sSolarTowerRecipes.mNEIName); + new GT_NEI_MultiSolarTower(GTPP_Recipe_Map.sSolarTowerRecipes); Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sAdvFreezerRecipes_GT.mNEIName); new GT_NEI_MultiNoCell(GTPP_Recipe_Map.sAdvFreezerRecipes_GT); Logger.INFO("NEI Registration: Registering NEI handler for "+GTPP_Recipe_Map.sMultiblockCentrifugeRecipes_GT.mNEIName); diff --git a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java index 382d52cc9b..325345fc05 100644 --- a/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java +++ b/src/main/java/gtPlusPlus/nei/NEI_IMC_Sender.java @@ -24,6 +24,8 @@ public class NEI_IMC_Sender { setNBTInfoAndSendIt("gtpp.recipe.multielectro", "gregtech:gt.blockmachines:796", 1); setNBTInfoAndSendIt("gtpp.recipe.simplewasher", "gregtech:gt.blockmachines:767"); setNBTInfoAndSendIt("gtpp.recipe.vacfurnace", "gregtech:gt.blockmachines:995", 1); + setNBTInfoAndSendIt("gtpp.recipe.thermalgeneratorfuel", "gregtech:gt.blockmachines:875", 1); + setNBTInfoAndSendIt("gtpp.recipe.solartower", "gregtech:gt.blockmachines:863", 1); setNBTInfoAndSendIt("gtpp.recipe.fissionfuel", "gregtech:gt.blockmachines:835", 1); setNBTInfoAndSendIt("gtpp.recipe.lftr", "gregtech:gt.blockmachines:751", 1); setNBTInfoAndSendIt("gtpp.recipe.lftr.sparging", "gregtech:gt.blockmachines:31035", 1); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index cd8b5d3151..fd5d1fcff2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -301,7 +301,7 @@ public enum GregtechItemList implements GregtechItemContainer { //Tesla Tower - /*TelsaTower,*/ + TelsaTower, Casing_TeslaTower, @@ -334,7 +334,7 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_Adv_DistillationTower, //Advanced Assembly Line - /*Machine_Adv_AssemblyLine,*/ + Machine_Adv_AssemblyLine, //Advanced Vacuum Freezer Industrial_Cryogenic_Freezer, @@ -363,7 +363,7 @@ public enum GregtechItemList implements GregtechItemContainer { Casing_Industrial_Arc_Furnace, //Solar Tower - /*Industrial_Solar_Tower,*/ + Industrial_Solar_Tower, Casing_SolarTower_Structural, Casing_SolarTower_SaltContainment, Casing_SolarTower_HeatContainment, @@ -571,7 +571,7 @@ public enum GregtechItemList implements GregtechItemContainer { SimpleDustWasher_UV, //Solar Tower Reflector - /*Solar_Tower_Reflector,*/ + Solar_Tower_Reflector, //Super Tier Chests Super_Chest_LV, Super_Chest_MV, Super_Chest_HV, Super_Chest_EV, Super_Chest_IV, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java index 419b5f3d30..13eb045748 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java @@ -21,7 +21,7 @@ extends GregtechMetaCasingBlocksAbstract { public GregtechMetaCasingBlocks4() { super(GregtechMetaCasingItems.class, "gtplusplus.blockcasings.4", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { - if (i == 2 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 12 || i == 13 || i == 14 || i == 15) { + if (i == 2 || i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 12 || i == 13 || i == 14 || i == 15) { continue; } TAE.registerTexture(3, i, new GT_CopiedBlockTexture(this, 6, i)); @@ -87,7 +87,7 @@ extends GregtechMetaCasingBlocksAbstract { case 8: return Textures.BlockIcons.RENDERING_ERROR.getIcon(); case 9: - return Textures.BlockIcons.RENDERING_ERROR.getIcon(); + return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); case 10: if (aSide <2) { return TexturesGtBlock.TEXTURE_STONE_RED_B.getIcon(); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java index 7ddf16b36f..b5c07ecd95 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/misc/GregtechMTE_TeslaTower.java @@ -1,18 +1,13 @@ -/* package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.misc; -import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.GT_Values.W; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; @@ -23,21 +18,28 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; - import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.entity.EntityTeslaTowerLightning; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { +public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase<GregtechMTE_TeslaTower> { private Block casingBlock; private int casingMeta; @@ -49,12 +51,12 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { private int xLoc, yLoc, zLoc; protected int mRange; - */ -/** + + /** * Machine Mode, * {@value false} Attacks all entities, * {@value true} Only attacks players. - *//* + */ protected volatile boolean mMode = false; @@ -88,7 +90,7 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { return null; } - @Override + /*@Override public String[] getTooltip() { String casings = getCasingBlockItem().get(0).getDisplayName(); return new String[]{ @@ -102,13 +104,33 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { "1x3x1 " + MaterialUtils.getMaterialName(getFrameMaterial()) + " Frame Boxes (Each pillar side and on top)", "1x Maintenance Hatch (One of base casings)", "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)"}; + }*/ + + @Override + protected final GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType(getMachineType()) + .addInfo("Controller Block for the Tesla Defence Tower Mk3200") + .addInfo("Enemies within "+this.mRange+"m are blasted with a high energy plasma.") + .addInfo("This uses 5,000,000EU per blast.") + .addInfo("Can screwdriver to toggle mode between Players and all Entities.") + .addSeparator() + .beginStructureBlock(1, 7, 1, false) + .addController("Top Middle") + .addCasingInfo("Casing", 360) + .addOtherStructurePart("Rotor Assembly", "Any 1 dot hint", 1) + .addInputBus("Any 4 dot hint (min 1)", 4) + .addInputHatch("Any 4 dot hint(min 1)", 4) + .addOutputHatch("Any 4 dot hint(min 1)", 4) + .addEnergyHatch("Any 4 dot hint(min 1)", 4) + .addMaintenanceHatch("Any 4 dot hint(min 1)", 4) + .toolTipFinisher(CORE.GT_Tooltip_Builder); + return tt; } private final void initFields() { casingBlock = ModBlocks.blockCasings2Misc; casingMeta = getCasingBlockItem().get(0).getItemDamage(); - int frameId = 4096 + getFrameMaterial().mMetaItemSubID; - frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W; casingTextureIndex = getCasingTextureIndex(); mRange = 50; } @@ -144,26 +166,24 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { @Override public boolean checkRecipe(ItemStack aStack) { - */ -/*if (!isEnergyEnough()) { + + if (!isEnergyEnough()) { this.mProgresstime = 0; this.mMaxProgresstime = 20; this.getBaseMetaTileEntity().setActive(false); stopMachine(); } - else {*//* -*/ -/* + else { this.mProgresstime = 1; this.mMaxProgresstime = 100; - this.getBaseMetaTileEntity().setActive(true);*//* + this.getBaseMetaTileEntity().setActive(true); - //} + } return false; } @Override - public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { updateCoordinates(); //check base layer for (int xOff = -1 + back.offsetX; xOff <= 1 + back.offsetX; xOff++) { @@ -414,16 +434,6 @@ public class GregtechMTE_TeslaTower extends GregtechMeta_MultiBlockBase { return GregtechItemList.Casing_TeslaTower; } - protected Materials getFrameMaterial() { - */ -/*casingBlock = getCasingBlockItem().getBlock(); - casingMeta = getCasingBlockItem().get(0).getItemDamage(); - int frameId = 4096 + getFrameMaterial().mMetaItemSubID; - frameMeta = GregTech_API.METATILEENTITIES[frameId] != null ? GregTech_API.METATILEENTITIES[frameId].getTileEntityBaseType() : W; - *//* -return Materials.get("TungstenCarbide"); - } - protected int getCasingTextureIndex() { return TAE.GTPP_INDEX(30); } @@ -474,6 +484,17 @@ return Materials.get("TungstenCarbide"); return 0; } + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + // TODO Auto-generated method stub + + } + + @Override + public IStructureDefinition getStructureDefinition() { + // TODO Auto-generated method stub + return null; + } + } -*/ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java index 8c9e886e94..7461aa247e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_AssemblyLine.java @@ -1,7 +1,9 @@ -/* package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; import java.util.ArrayList; + +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; + import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; @@ -14,12 +16,13 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.LangUtils; import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Naquadah; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; @@ -29,12 +32,11 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; -public class GregtechMetaTileEntity_Adv_AssemblyLine - extends GregtechMeta_MultiBlockBase { +public class GregtechMetaTileEntity_Adv_AssemblyLine extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_Adv_AssemblyLine> { - public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>(); - - public static String[] mCasingName = new String[5]; + public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>(); + + public static String[] mCasingName = new String[5]; private final int CASING_TEXTURE_ID = TAE.getIndexFromPage(0, 13); private final int META_BaseCasing = 0; //4 private final int META_ContainmentCasing = 15; //3 @@ -42,46 +44,67 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine private final int META_PipeCasing = 1; //4 private final int META_IntegralCasing = 6; //0 private final int META_ContainmentChamberCasing = 2; //4 - - - public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); + + + public GregtechMetaTileEntity_Adv_AssemblyLine(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0); mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1); mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2); mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15); mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13); - } + } - public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) { - super(aName); - } + public GregtechMetaTileEntity_Adv_AssemblyLine(String aName) { + super(aName); + } - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName); - } + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_Adv_AssemblyLine(this.mName); + } + + /* public String[] getTooltip() { + if (mCasingName[0].toLowerCase().contains(".name")) { + mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0); + } + if (mCasingName[1].toLowerCase().contains(".name")) { + mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1); + } + if (mCasingName[2].toLowerCase().contains(".name")) { + mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2); + } + if (mCasingName[3].toLowerCase().contains(".name")) { + mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15); + } + if (mCasingName[4].toLowerCase().contains(".name")) { + mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13); + } + return new String[]{ + "Advanced Integrated Assembly Line" + }; + }*/ + + @Override + protected final GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType(getMachineType()) + .addInfo("Controller Block for the Tesla Defence Tower Mk3200") + .addInfo("This uses 5,000,000EU per blast.") + .addInfo("Can screwdriver to toggle mode between Players and all Entities.") + .addSeparator() + .beginStructureBlock(1, 7, 1, false) + .addController("Top Middle") + .addCasingInfo("Casing", 360) + .addOtherStructurePart("Rotor Assembly", "Any 1 dot hint", 1) + .addInputBus("Any 4 dot hint (min 1)", 4) + .addInputHatch("Any 4 dot hint(min 1)", 4) + .addOutputHatch("Any 4 dot hint(min 1)", 4) + .addEnergyHatch("Any 4 dot hint(min 1)", 4) + .addMaintenanceHatch("Any 4 dot hint(min 1)", 4) + .toolTipFinisher(CORE.GT_Tooltip_Builder); + return tt; + } - public String[] getTooltip() { - if (mCasingName[0].toLowerCase().contains(".name")) { - mCasingName[0] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 0); - } - if (mCasingName[1].toLowerCase().contains(".name")) { - mCasingName[1] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 1); - } - if (mCasingName[2].toLowerCase().contains(".name")) { - mCasingName[2] = LangUtils.getLocalizedNameOfBlock(getCasing(4), 2); - } - if (mCasingName[3].toLowerCase().contains(".name")) { - mCasingName[3] = LangUtils.getLocalizedNameOfBlock(getCasing(3), 15); - } - if (mCasingName[4].toLowerCase().contains(".name")) { - mCasingName[4] = LangUtils.getLocalizedNameOfBlock(getCasing(1), 13); - } - return new String[]{ - "Advanced Integrated Assembly Line" - }; - } - private Block getCasing(int casingID) { if (casingID == 1) { return ModBlocks.blockCasingsMisc; @@ -100,155 +123,151 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine } } - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)}; - } - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16)}; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png"); - } - - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return null; - } - - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - - public boolean checkRecipe(ItemStack aStack) { - if(GT_Values.D1)System.out.println("Start ALine recipe check"); - ArrayList<ItemStack> tDataStickList = getDataItems(2); - if (tDataStickList.size() == 0) return false; - if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found"); - - ItemStack tStack[] = new ItemStack[15]; - FluidStack[] tFluids = new FluidStack[4]; - boolean findRecipe = false; - nextDS:for (ItemStack tDataStick : tDataStickList){ - NBTTagCompound tTag = tDataStick.getTagCompound(); - if (tTag == null) continue; - for (int i = 0; i < 15; i++) { - int count = tTag.getInteger("a"+i); - if (!tTag.hasKey("" + i) && count <= 0) continue; - if (mInputBusses.get(i) == null) { - continue nextDS; - } - - ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); - boolean flag = true; - if (count > 0) { - for (int j = 0; j < count; j++) { - tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j); - if (tStack[i] == null) continue; - if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); - if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { - flag = false; - break; - } - } - } - if (flag) { - tStack[i] = GT_Utility.loadItem(tTag, "" + i); - if (tStack[i] == null) { - flag = false; - continue; - } - if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); - if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { - flag = false; - } - } - if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted")); - if (flag) continue nextDS; - } - - if(GT_Values.D1)System.out.println("All Items done, start fluid check"); - for (int i = 0; i < 4; i++) { - if (!tTag.hasKey("f" + i)) continue; - tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i); - if (tFluids[i] == null) continue; - if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName()); - if (mInputHatches.get(i) == null) { - continue nextDS; - } - FluidStack fluidInHatch = mInputHatches.get(i).mFluid; - if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { - if(GT_Values.D1)System.out.println(i+" not accepted"); - continue nextDS; - } - if(GT_Values.D1)System.out.println(i+" accepted"); - } - - if(GT_Values.D1)System.out.println("Input accepted, check other values"); - if (!tTag.hasKey("output")) continue; - mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")}; - if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0])) - continue; - - if (!tTag.hasKey("time")) continue; - mMaxProgresstime = tTag.getInteger("time"); - if (mMaxProgresstime <= 0) continue; - - if (!tTag.hasKey("eu")) continue; - mEUt = tTag.getInteger("eu"); - - if(GT_Values.D1)System.out.println("Find avaiable recipe"); - findRecipe = true; - break; - } - if (!findRecipe) return false; - - if(GT_Values.D1)System.out.println("All checked start consuming inputs"); - for (int i = 0; i < 15; i++) { - if (tStack[i] == null) continue; - ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); - stackInSlot.stackSize -= tStack[i].stackSize; - } - - for (int i = 0; i < 4; i++) { - if (tFluids[i] == null) continue; - mInputHatches.get(i).mFluid.amount -= tFluids[i].amount; - if (mInputHatches.get(i).mFluid.amount <= 0) { - mInputHatches.get(i).mFluid = null; - } - } - if(GT_Values.D1)System.out.println("Check overclock"); - - byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - if (mEUt <= 16) { - this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1)); - this.mMaxProgresstime = (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); - updateSlots(); - if(GT_Values.D1)System.out.println("Recipe sucessfull"); - return true; - } - - public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { - super.startSoundLoop(aIndex, aX, aY, aZ); - if (aIndex == 20) { - GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ); - } - } + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)}; + } + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(16)}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean checkRecipe(ItemStack aStack) { + if(GT_Values.D1)System.out.println("Start ALine recipe check"); + ArrayList<ItemStack> tDataStickList = getDataItems(2); + if (tDataStickList.size() == 0) return false; + if(GT_Values.D1)System.out.println("Stick accepted, " + tDataStickList.size() + " Data Sticks found"); + + ItemStack tStack[] = new ItemStack[15]; + FluidStack[] tFluids = new FluidStack[4]; + boolean findRecipe = false; + nextDS:for (ItemStack tDataStick : tDataStickList){ + NBTTagCompound tTag = tDataStick.getTagCompound(); + if (tTag == null) continue; + for (int i = 0; i < 15; i++) { + int count = tTag.getInteger("a"+i); + if (!tTag.hasKey("" + i) && count <= 0) continue; + if (mInputBusses.get(i) == null) { + continue nextDS; + } + + ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); + boolean flag = true; + if (count > 0) { + for (int j = 0; j < count; j++) { + tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j); + if (tStack[i] == null) continue; + if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + break; + } + } + } + if (flag) { + tStack[i] = GT_Utility.loadItem(tTag, "" + i); + if (tStack[i] == null) { + flag = false; + continue; + } + if(GT_Values.D1)System.out.println("Item "+i+" : "+tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + } + } + if(GT_Values.D1) System.out.println(i + (flag ? " not accepted" : " accepted")); + if (flag) continue nextDS; + } + + if(GT_Values.D1)System.out.println("All Items done, start fluid check"); + for (int i = 0; i < 4; i++) { + if (!tTag.hasKey("f" + i)) continue; + tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i); + if (tFluids[i] == null) continue; + if(GT_Values.D1)System.out.println("Fluid "+i+" "+tFluids[i].getUnlocalizedName()); + if (mInputHatches.get(i) == null) { + continue nextDS; + } + FluidStack fluidInHatch = mInputHatches.get(i).mFluid; + if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { + if(GT_Values.D1)System.out.println(i+" not accepted"); + continue nextDS; + } + if(GT_Values.D1)System.out.println(i+" accepted"); + } + + if(GT_Values.D1)System.out.println("Input accepted, check other values"); + if (!tTag.hasKey("output")) continue; + mOutputItems = new ItemStack[]{GT_Utility.loadItem(tTag, "output")}; + if (mOutputItems[0] == null || !GT_Utility.isStackValid(mOutputItems[0])) + continue; + + if (!tTag.hasKey("time")) continue; + mMaxProgresstime = tTag.getInteger("time"); + if (mMaxProgresstime <= 0) continue; + + if (!tTag.hasKey("eu")) continue; + mEUt = tTag.getInteger("eu"); + + if(GT_Values.D1)System.out.println("Find avaiable recipe"); + findRecipe = true; + break; + } + if (!findRecipe) return false; + + if(GT_Values.D1)System.out.println("All checked start consuming inputs"); + for (int i = 0; i < 15; i++) { + if (tStack[i] == null) continue; + ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); + stackInSlot.stackSize -= tStack[i].stackSize; + } + + for (int i = 0; i < 4; i++) { + if (tFluids[i] == null) continue; + mInputHatches.get(i).mFluid.amount -= tFluids[i].amount; + if (mInputHatches.get(i).mFluid.amount <= 0) { + mInputHatches.get(i).mFluid = null; + } + } + if(GT_Values.D1)System.out.println("Check overclock"); + + byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + if (mEUt <= 16) { + this.mEUt = (mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (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); + updateSlots(); + if(GT_Values.D1)System.out.println("Recipe sucessfull"); + return true; + } + + public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { + super.startSoundLoop(aIndex, aX, aY, aZ); + if (aIndex == 20) { + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ); + } + } public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4; @@ -314,7 +333,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine if (aOwnerName != null && aOwnerName.length() > 0) { aOwner = PlayerUtils.getPlayer(aOwnerName); } - + if (aShieldingCount != 128) { log("Not enough "+mCasingName[4]+"s, require 128."); if (aOwner != null) { @@ -365,18 +384,18 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine } public boolean addNaquadahHatchToMachineInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); - } - return false; + if (aTileEntity == null) { + return false; + } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); + } + return false; } public int checkEntireLayer(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { @@ -394,7 +413,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine if (aY == 0 && x == 0 && z == 0) { continue; } - + Block aCurrentBlock = aBaseMetaTileEntity.getBlockOffset(xDir + x, aY, zDir + z); int aCurrentMeta = (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + x, aY, zDir + z); if (aCurrentBlock == aBlock && aCurrentMeta == aMeta) { @@ -485,7 +504,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine } return aCasingCount; } - + public int checkPipes(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { int aCasingCount = 0; for (int x = -1; x < 2; x++) { @@ -511,7 +530,7 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine } return aCasingCount; } - + public int checkContainmentRing(IGregTechTileEntity aBaseMetaTileEntity, Block aBlock, int aMeta, int aY, int xDir, int zDir) { int aCasingCount = 0; for (int x = -2; x < 3; x++) { @@ -539,67 +558,65 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine } return aCasingCount; } - - */ -/** - * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb - *//* - - private boolean isCorrectDataItem(ItemStack aStack, int state){ - if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true; - if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true; - if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true; - return false; - } - - */ -/** - * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb - *//* - - public ArrayList<ItemStack> getDataItems(int state) { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); - if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) { - rList.add(mInventory[1]); - } - for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) { - if (isValidMetaTileEntity(tHatch)) { - for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) { - if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null - && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state)) - rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); - } - } - } - return rList; - } - - public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); - } - return false; - } - - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } + + /** + * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb + */ + + private boolean isCorrectDataItem(ItemStack aStack, int state){ + if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true; + if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true; + if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true; + return false; + } + + /** + * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb + */ + + public ArrayList<ItemStack> getDataItems(int state) { + ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); + if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) { + rList.add(mInventory[1]); + } + for (GT_MetaTileEntity_Hatch_DataAccess tHatch : mDataAccessHatches) { + if (isValidMetaTileEntity(tHatch)) { + for (int i = 0; i < tHatch.getBaseMetaTileEntity().getSizeInventory(); i++) { + if (tHatch.getBaseMetaTileEntity().getStackInSlot(i) != null + && isCorrectDataItem(tHatch.getBaseMetaTileEntity().getStackInSlot(i), state)) + rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + } + return rList; + } + + public boolean addDataAccessToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return mDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) aMetaTileEntity); + } + return false; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } @Override public boolean hasSlotInGUI() { @@ -625,5 +642,35 @@ public class GregtechMetaTileEntity_Adv_AssemblyLine public int getEuDiscountForParallelism() { return 0; } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + // Fix GT bug + if (this.getBaseMetaTileEntity().getFrontFacing() != 1) { + log("Fixing Bad Facing. (GT Bug)"); + this.getBaseMetaTileEntity().setFrontFacing((byte) 1); + } + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + // TODO Auto-generated method stub + + } + + @Override + public IStructureDefinition getStructureDefinition() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean checkMachine( + IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack + ) { + // TODO Auto-generated method stub + return false; + } } -*/ + diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java index 65474d38ed..71d8bc5740 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GT4Entity_ThermalBoiler.java @@ -16,11 +16,15 @@ import gregtech.api.util.*; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.item.general.ItemLavaFilter; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.MISC_MATERIALS; +import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; @@ -72,6 +76,9 @@ extends GregtechMeta_MultiBlockBase } private static Item mLavaFilter; + private static Fluid mLava = null; + private static Fluid mPahoehoe = null; + private static Fluid mSolarSaltHot = null; @Override public boolean checkRecipe(ItemStack aStack) { @@ -80,6 +87,17 @@ extends GregtechMeta_MultiBlockBase if (mLavaFilter == null) { mLavaFilter = ItemList.Component_LavaFilter.getItem(); } + if (mLava == null) { + mLava = FluidRegistry.LAVA; + } + if (mPahoehoe == null) { + mPahoehoe = FluidUtils.getPahoehoeLava(1).getFluid(); + } + if (mSolarSaltHot == null) { + mSolarSaltHot = MISC_MATERIALS.SOLAR_SALT_HOT.getFluid(); + } + + //Try reload new Lava Filter if (aStack == null) { @@ -94,43 +112,51 @@ extends GregtechMeta_MultiBlockBase for (GT_Recipe tRecipe : GTPP_Recipe.GTPP_Recipe_Map.sThermalFuels.mRecipeList) { FluidStack tFluid = tRecipe.mFluidInputs[0]; if (tFluid != null) { - if (depleteInput(tFluid)) { - this.mMaxProgresstime = Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2)); - this.mEUt = getEUt(); - this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease()); - - int loot_MAXCHANCE = 100000; - if (mLavaFilter.getClass().isInstance(aStack.getItem())) { - - if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) }; - } - if ((tRecipe.getOutput(1) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(1))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(1) }) }; - } - if ((tRecipe.getOutput(2) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(2))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(2) }) }; - } - if ((tRecipe.getOutput(3) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(3))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(3) }) }; - } - if ((tRecipe.getOutput(4) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(4))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(4) }) }; - } - if ((tRecipe.getOutput(5) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(5))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(5) }) }; - } - + + if (tFluid.getFluid() == mLava || tFluid.getFluid() == mPahoehoe) { + if (depleteInput(tFluid)) { + this.mMaxProgresstime = Math.max(1, runtimeBoost(tRecipe.mSpecialValue * 2)); + this.mEfficiencyIncrease = (this.mMaxProgresstime * getEfficiencyIncrease()); + + int loot_MAXCHANCE = 100000; + if (mLavaFilter.getClass().isInstance(aStack.getItem())) { + if ((tRecipe.getOutput(0) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(0))) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(0) }) }; + } + if ((tRecipe.getOutput(1) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(1))) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(1) }) }; + } + if ((tRecipe.getOutput(2) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(2))) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(2) }) }; + } + if ((tRecipe.getOutput(3) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(3))) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(3) }) }; + } + if ((tRecipe.getOutput(4) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(4))) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(4) }) }; + } + if ((tRecipe.getOutput(5) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(5))) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(5) }) }; + } + } + //Give Obsidian without Lava Filter + if (tFluid.getFluid() == mLava){ + if ((tRecipe.getOutput(6) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(6))) { + this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(6) }) }; + } + } + return true; } - //Give Obsidian without Lava Filter - if (tFluid.isFluidEqual(GT_ModHandler.getLava(86))){ - if ((tRecipe.getOutput(6) != null) && (getBaseMetaTileEntity().getRandomNumber(loot_MAXCHANCE) < tRecipe.getOutputChance(6))) { - this.mOutputItems = new ItemStack[] { GT_Utility.copy(new Object[] { tRecipe.getOutput(6) }) }; + } + else if (tFluid.getFluid() == mSolarSaltHot) { + if (depleteInput(tFluid)) { + this.mMaxProgresstime = tRecipe.mDuration; + this.mEfficiency = 10000; + for (FluidStack aOutput : tRecipe.mFluidOutputs) { + this.addOutput(FluidUtils.getFluidStack(aOutput, aOutput.amount)); } + return true; } - - - return true; } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java index d42b33a403..371014f8c9 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_SolarTower.java @@ -1,10 +1,15 @@ -/* package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.lazy; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; + +import java.util.ArrayList; + +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.GregTech_API; import gregtech.api.enums.TAE; @@ -12,13 +17,19 @@ 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_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.tileentities.misc.TileEntitySolarHeater; @@ -27,24 +38,29 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; -public class GregtechMetaTileEntity_SolarTower -extends GregtechMeta_MultiBlockBase { +public class GregtechMetaTileEntity_SolarTower extends GregtechMeta_MultiBlockBase<GregtechMetaTileEntity_SolarTower> { //862 - private static final int mCasingTextureID = TAE.getIndexFromPage(3, 4); - public static String mCasingName = ""; - private int mHeight = 0; + private static final int mCasingTextureID = TAE.getIndexFromPage(3, 9); private int mHeatLevel = 0; + private int mCasing1; + private int mCasing2; + private int mCasing3; + private int mCasing4; + + + public ArrayList<TileEntitySolarHeater> mSolarHeaters = new ArrayList<TileEntitySolarHeater>(); + public GregtechMetaTileEntity_SolarTower(final int aID, final String aName, final String aNameRegional) { super(aID, aName, aNameRegional); - mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4); } public GregtechMetaTileEntity_SolarTower(final String aName) { super(aName); - mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4); } @Override @@ -58,14 +74,316 @@ extends GregtechMeta_MultiBlockBase { } @Override - public String[] getTooltip() { - if (mCasingName.toLowerCase().contains(".name")) { - mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 4); + protected final GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType(getMachineType()) + .addInfo("Contributing Green Energy towards the future") + .addInfo("Input: "+MISC_MATERIALS.SOLAR_SALT_COLD.getFluid().getLocalizedName()) + .addInfo("Output: "+MISC_MATERIALS.SOLAR_SALT_HOT.getFluid().getLocalizedName()) + .addInfo("Surround with rings of Solar Heaters") + .addInfo("Each ring increases tier") + .addInfo("1 = 1, 2 = 2, 3 = 4, 4 = 8, 5 = 16") + .addInfo("Tier decreases heating time and allows more salt to be processed") + .addSeparator() + .beginStructureBlock(6, 27, 6, false) + .addController("Top Middle") + .addCasingInfo("Structural Solar Casing", 229) + .addCasingInfo("Thermally Insulated Casing", 60) + .addCasingInfo("Salt Containment Casing", 66) + .addCasingInfo("Thermal Containment Casing", 60) + .addInputHatch("Any 2 dot hint(min 1)", 2) + .addOutputHatch("Any 2 dot hint(min 1)", 2) + .addMaintenanceHatch("Any 2 dot hint", 2) + .toolTipFinisher(CORE.GT_Tooltip_Builder); + return tt; + } + + private static final String STRUCTURE_PIECE_BASE = "base"; + private static final String STRUCTURE_PIECE_TOWER = "tower"; + private static final String STRUCTURE_PIECE_TOP = "top"; + + private static final String SOLAR_HEATER_RING_1 = "ring1"; + private static final String SOLAR_HEATER_RING_2 = "ring2"; + private static final String SOLAR_HEATER_RING_3 = "ring3"; + private static final String SOLAR_HEATER_RING_4 = "ring4"; + private static final String SOLAR_HEATER_RING_5 = "ring5"; + + private static final ClassValue<IStructureDefinition<GregtechMetaTileEntity_SolarTower>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<GregtechMetaTileEntity_SolarTower>>() { + @Override + protected IStructureDefinition<GregtechMetaTileEntity_SolarTower> computeValue(Class<?> type) { + return StructureDefinition.<GregtechMetaTileEntity_SolarTower>builder() + + // s = salt + // c = thermal containment + // i = thermal insulated + // t = solar structural + // h = hatch + // g = solar heater + + .addShape(STRUCTURE_PIECE_TOP, (new String[][]{ + {" ", " ", " ~ ", " ", " "}, + {" ", " s ", " sss ", " s ", " "}, + {" c ", " ccc ", "ccscc", " ccc ", " c "}, + {" c ", " ccc ", "ccscc", " ccc ", " c "}, + {" c ", " ccc ", "ccscc", " ccc ", " c "}, + {" c ", " ccc ", "ccscc", " ccc ", " c "}, + {" c ", " ccc ", "ccscc", " ccc ", " c "}, + })) + .addShape(STRUCTURE_PIECE_TOWER, (new String[][]{ + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + {" i ", "isi", " i "}, + })) + .addShape(STRUCTURE_PIECE_BASE, (new String[][]{ + {" ", " ", " t ", " ttt ", " ttstt ", " ttssstt ", " ttstt ", " ttt ", " t ", " ", " "}, + {" ", " ", " t ", " ttt ", " tssst ", " ttssstt ", " tssst ", " ttt ", " t ", " ", " "}, + {" ", " t ", " ttt ", " ttttt ", " ttssstt ", " tttsssttt ", " ttssstt ", " ttttt ", " ttt ", " t ", " "}, + {" ", " t ", " ttt ", " ttttt ", " ttssstt ", " tttsssttt ", " ttssstt ", " ttttt ", " ttt ", " t ", " "}, + {" hhh ", " ttttt ", " ttttttt ", " ttttttttt ", "htttsssttth", "htttsssttth", "htttsssttth", " ttttttttt ", " ttttttt ", " ttttt ", " hhh "}, + {" hhh ", " ttttt ", " ttttttt ", " ttttttttt ", "httttttttth", "httttttttth", "httttttttth", " ttttttttt ", " ttttttt ", " ttttt ", " hhh "}, + })) + + + .addShape(SOLAR_HEATER_RING_1, (new String[][]{ + { + " ggggg ", + " g g ", + " g g ", + " g g ", + " g g ", + "g g", + "g g", + "g g", + "g g", + "g g", + " g g ", + " g g ", + " g g ", + " g g ", + " ggggg ", + }})) + .addShape(SOLAR_HEATER_RING_2, (new String[][]{ + { + " ggggggggg ", + " g g ", + " g g ", + " g g ", + " g g ", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + " g g ", + " g g ", + " g g ", + " g g ", + " ggggggggg ", + }})) + .addShape(SOLAR_HEATER_RING_3, (new String[][]{ + { + " ggggggggggggg ", + " g g ", + " g g ", + " g g ", + " g g ", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + " g g ", + " g g ", + " g g ", + " g g ", + " ggggggggggggg ", + }})) + .addShape(SOLAR_HEATER_RING_4, (new String[][]{ + { + " ggggggggggggggggg ", + " g g ", + " g g ", + " g g ", + " g g ", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + " g g ", + " g g ", + " g g ", + " g g ", + " ggggggggggggggggg ", + }})) + .addShape(SOLAR_HEATER_RING_5, (new String[][]{ + { + " ggggggggggggggggggggg ", + " g g ", + " g g ", + " g g ", + " g g ", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + "g g", + " g g ", + " g g ", + " g g ", + " g g ", + " ggggggggggggggggggggg ", + }})) + + .addElement('g', lazy(t -> ofHatchAdder(GregtechMetaTileEntity_SolarTower::addSolarHeater, 0, 1))) + .addElement('t', lazy(t -> onElementPass(x -> ++x.mCasing1, ofBlock(t.getCasingBlock(), t.getCasingMeta())))) + .addElement('i', lazy(t -> onElementPass(x -> ++x.mCasing2, ofBlock(t.getCasingBlock(), t.getCasingMeta2())))) + .addElement('s', lazy(t -> onElementPass(x -> ++x.mCasing3, ofBlock(t.getCasingBlock(), t.getCasingMeta3())))) + .addElement('c', lazy(t -> onElementPass(x -> ++x.mCasing4, ofBlock(t.getCasingBlock2(), t.getCasingMeta4())))) + .addElement('h', lazy(t -> ofChain( + ofHatchAdder(GregtechMetaTileEntity_SolarTower::addGenericHatch, t.getCasingTextureIndex(), 2), + onElementPass(x -> ++x.mCasing1, ofBlock(t.getCasingBlock(), t.getCasingMeta()))))) + + + .build(); } - return new String[]{ - "Contributing Green Energy towards the future", - mCasingName+"s for the base of the tower", - }; + }; + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + resetSolarHeaters(); + this.mMaintenanceHatches.clear(); + this.mInputHatches.clear(); + this.mOutputHatches.clear(); + mCasing1 = 0; + mCasing2 = 0; + mCasing3 = 0; + mCasing4 = 0; + + boolean aStructureTop = checkPiece(STRUCTURE_PIECE_TOP, 2, 2, 0); + log("Top Check: "+aStructureTop); + boolean aStructureTower = checkPiece(STRUCTURE_PIECE_TOWER, 1, 1, -7); + log("Tower Check: "+aStructureTower); + boolean aStructureBase = checkPiece(STRUCTURE_PIECE_BASE, 5, 5, -22); + log("Base Check: "+aStructureBase); + boolean aCasingCount1 = mCasing1 >= 229; + boolean aCasingCount2 = mCasing2 == 60; + boolean aCasingCount3 = mCasing3 == 66; + boolean aCasingCount4 = mCasing4 == 60; + boolean aAllStructure = aStructureTop && aStructureTower && aStructureBase; + boolean aAllCasings = aCasingCount1 && aCasingCount2 && aCasingCount3 && aCasingCount4; + if (!aAllCasings || !aAllStructure || + mMaintenanceHatches.size() != 1 || + mInputHatches.size() < 1 || + mOutputHatches.size() < 1 + ) { + log("Bad Hatches - Solar Heaters: "+mSolarHeaters.size()+ + ", Maint: "+mMaintenanceHatches.size()+ + ", Input Hatches: "+mInputHatches.size()+ + ", Output Hatches: "+mOutputHatches.size()+ + ", Top: "+aStructureTop+ + ", Tower: "+aStructureTower+ + ", Base: "+aStructureBase+ + ", Casing Count: "+aCasingCount1+" | Found: "+mCasing1+ + ", Casing Count: "+aCasingCount2+" | Found: "+mCasing2+ + ", Casing Count: "+aCasingCount3+" | Found: "+mCasing3+ + ", Casing Count: "+aCasingCount4+" | Found: "+mCasing4); + return false; + } + log("Built "+this.getLocalName()+" with "+mCasing1+" Structural Solar casings, "+mCasing2+" Thermally Insulated casings, "+mCasing3+" Salt Containment casings, "+mCasing4+" Thermal Containment casings."); + return aAllCasings && aAllStructure; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + // Tower + buildPiece(STRUCTURE_PIECE_TOP, stackSize, hintsOnly, 2, 2, 0); + buildPiece(STRUCTURE_PIECE_TOWER, stackSize, hintsOnly, 1, 1, -7); + buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 5, 5, -22); + + //Solar Heaters + buildPiece(SOLAR_HEATER_RING_1, stackSize, hintsOnly, 7, 7, -27); + buildPiece(SOLAR_HEATER_RING_2, stackSize, hintsOnly, 9, 9, -27); + buildPiece(SOLAR_HEATER_RING_3, stackSize, hintsOnly, 11, 11, -27); + buildPiece(SOLAR_HEATER_RING_4, stackSize, hintsOnly, 13, 13, -27); + buildPiece(SOLAR_HEATER_RING_5, stackSize, hintsOnly, 15, 15, -27); + } + + @Override + public IStructureDefinition<GregtechMetaTileEntity_SolarTower> getStructureDefinition() { + return STRUCTURE_DEFINITION.get(getClass()); + } + + public final boolean addGenericHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + else { + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + return addToMachineList(aTileEntity, aBaseCasingIndex); + } + else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + return addToMachineList(aTileEntity, aBaseCasingIndex); + } + } + log("Bad Hatch"); + return false; } @Override @@ -76,10 +394,10 @@ extends GregtechMeta_MultiBlockBase { @Override public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == 0 || aSide == 1) { - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 6)), + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12)), new GT_RenderedTexture(aActive ? TexturesGtBlock.Overlay_Machine_Controller_Default_Active : TexturesGtBlock.Overlay_Machine_Controller_Default)}; } - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.getIndexFromPage(3, 6))}; + return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(TAE.GTPP_INDEX(12))}; } @Override @@ -97,68 +415,174 @@ extends GregtechMeta_MultiBlockBase { return null; } - @Override - public boolean isFacingValid(final byte aFacing) { - return aFacing <= 1; - } - - private Set<String> mCachedReflectors = new HashSet<String>(); - - public Set<String> getConnectedSolarReflectors(){ - Set<String> mValidTilePositions = new HashSet<String>(); - IGregTechTileEntity tTileEntity; - Map<String, BlockPos> mFastMap = new HashMap<String, BlockPos>(); - for (int x = -64; x <= 64; x++) { - for (int z = -64; z <= 64; z++) { - int aX, aY, aZ; - aX = this.getBaseMetaTileEntity().getXCoord(); - aY = this.mHeight; - aZ = this.getBaseMetaTileEntity().getZCoord(); - BlockPos b = new BlockPos(aX+x, aY, aZ+z, this.getBaseMetaTileEntity().getWorld()); - - tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aX + x, this.mHeight, aZ + z); - if (tTileEntity == null) { - continue; - } - else { - Logger.INFO("Found Tile Entity at "+b.getLocationString()); - if (tTileEntity.getMetaTileEntity() instanceof TileEntitySolarHeater) { - TileEntitySolarHeater mTile = (TileEntitySolarHeater) tTileEntity.getMetaTileEntity(); - if (mTile != null) { - b = new BlockPos(tTileEntity.getXCoord(), tTileEntity.getYCoord(), tTileEntity.getZCoord(), tTileEntity.getWorld()); - if (!mTile.mHasTower || mTile.mSolarTower == null) { - Logger.INFO("Found Solar Reflector, Injecting Data."); - mTile.setSolarTower(b); - } - mFastMap.put(b.getUniqueIdentifier(), b); - } - } - else { - continue; - } - } + private int getHeaterTier() { + int aSolarHeaterCounter = this.mSolarHeaters.size(); + if (aSolarHeaterCounter > 0) { + if (aSolarHeaterCounter == 36) { + return 1; + } + else if (aSolarHeaterCounter == 88) { + return 2; + } + else if (aSolarHeaterCounter == 156) { + return 4; + } + else if (aSolarHeaterCounter == 240) { + return 8; + } + else if (aSolarHeaterCounter == 340) { + return 16; + } + } + return 0; + } + + private int getHeaterCountForTier(int aTier) { + switch (aTier) { + case 1: + return 36; + case 2: + return 88; + case 4: + return 156; + case 8: + return 240; + case 16: + return 340; + default: + return 0; + } + } - if (addToMachineList(tTileEntity, mCasingTextureID)) { - continue; - } - } + public boolean getConnectedSolarReflectors(){ + + this.mSolarHeaters.clear(); + int aRing = 1; + + if (this.mSolarHeaters.size() < 36) { + // 15x15 + boolean aRing1 = checkPiece(SOLAR_HEATER_RING_1, 7, 7, -27); + if (aRing1) { + //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); + } + } + if (this.mSolarHeaters.size() < 88) { + // 17x17 + boolean aRing2 = checkPiece(SOLAR_HEATER_RING_2, 9, 9, -27); + if (aRing2) { + //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); + } + } + if (this.mSolarHeaters.size() < 156) { + // 19x19 + boolean aRing3 = checkPiece(SOLAR_HEATER_RING_3, 11, 11, -27); + if (aRing3) { + //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); + } + } + if (this.mSolarHeaters.size() < 240) { + // 21x21 + boolean aRing4 = checkPiece(SOLAR_HEATER_RING_4, 13, 13, -27); + if (aRing4) { + //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); + } + } + if (this.mSolarHeaters.size() < 340) { + // 23x23 + boolean aRing5 = checkPiece(SOLAR_HEATER_RING_5, 15, 15, -27); + if (aRing5) { + //log("Found Ring: "+(aRing++)+", Total: "+this.mSolarHeaters.size()); + } } + return mSolarHeaters.size() > 0; + } - for (BlockPos p : mFastMap.values()) { - if (mValidTilePositions.add(p.getUniqueIdentifier())); + private boolean addSolarHeater(IGregTechTileEntity aTileEntity, int a) { + if (aTileEntity == null) { + return false; + } + else { + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof TileEntitySolarHeater) { + TileEntitySolarHeater mTile = (TileEntitySolarHeater) aMetaTileEntity; + if (mTile != null) { + if (!mTile.hasSolarTower() && mTile.canSeeSky()) { + //Logger.INFO("Found Solar Reflector, Injecting Data."); + mTile.setSolarTower(this); + return this.mSolarHeaters.add(mTile); + } + } + } } - mCachedReflectors = mValidTilePositions; - return mCachedReflectors; + return false; } + + private Fluid mColdSalt = null; + private Fluid mHotSalt = null; @Override - public boolean checkRecipe(final ItemStack aStack) { - //this.mEfficiencyIncrease = 100; - //this.mMaxProgresstime = 100; - //this.mEUt = -4; + public boolean checkRecipe(final ItemStack aStack) { + this.mEfficiencyIncrease = 10; + this.mMaxProgresstime = 100; + + if (this.mSolarHeaters.isEmpty() || this.mSolarHeaters.size() < 340 || this.getTotalRuntimeInTicks() % 200 == 0) { + getConnectedSolarReflectors(); + } + + int aTier = getHeaterTier(); + int aHeaters = getHeaterCountForTier(aTier); + + //Manage Heat every 5s + //Add Heat First, if sources available + if (aHeaters > 0) { + for (int i = 0; i < aHeaters; i++) { + Math.min((this.mHeatLevel += aTier), 20000); + } + } + + //Remove Heat, based on time of day + if (mHeatLevel > 0) { + if (mHeatLevel > 20000) { + this.mHeatLevel = 20000; + } + } + World w = this.getBaseMetaTileEntity().getWorld(); + if (w != null) { + int aRemovalFactor = 0; + if (w.isDaytime()) { + aRemovalFactor = 1; + } + else { + aRemovalFactor = 8; + } + for (int i = 0; i<MathUtils.randInt((aHeaters/10), aHeaters); i++){ + this.mHeatLevel -= aRemovalFactor; + } + } + + if (this.mEfficiency == this.getMaxEfficiency(null) && this.mHeatLevel >= 10000) { + if (mColdSalt == null) { + mColdSalt = MISC_MATERIALS.SOLAR_SALT_COLD.getFluid(); + } + if (mHotSalt == null) { + mHotSalt = MISC_MATERIALS.SOLAR_SALT_HOT.getFluid(); + } + ArrayList<FluidStack> aFluids = this.getStoredFluids(); + for (FluidStack aFluid : aFluids) { + if (aFluid.getFluid().equals(mColdSalt)) { + if (aFluid.amount >= (aTier * 1000)) { + this.depleteInput(FluidUtils.getFluidStack(mColdSalt, (aTier * 1000))); + this.addOutput(FluidUtils.getFluidStack(mHotSalt, (aTier * 1000))); + break; + } + } + } + } + + return true; } - + @Override public int getMaxParallelRecipes() { return 1; @@ -175,27 +599,6 @@ extends GregtechMeta_MultiBlockBase { } @Override - public boolean checkMultiblock(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - this.mHeight = 0; - for (int i = 0; i <= 19; i++) { - if (!checkLayer(i)) { - Logger.INFO("Invalid Structure on Y level "+i); - return false; - } - } - if (mMaintenanceHatches.size() != 1) { - Logger.INFO("Bad Hatches"); - return false; - } - - this.mHeight = this.getBaseMetaTileEntity().getYCoord() - 19; - Logger.INFO("Built Structure"); - if (!aBaseMetaTileEntity.getWorld().isRemote) - getConnectedSolarReflectors(); - return true; - } - - @Override public int getMaxEfficiency(final ItemStack aStack) { return 10000; } @@ -216,36 +619,29 @@ extends GregtechMeta_MultiBlockBase { } public Block getCasingBlock() { - return ModBlocks.blockCasings4Misc; + return ModBlocks.blockSpecialMultiCasings; } + public Block getCasingBlock2() { + return ModBlocks.blockCasings2Misc; + } public byte getCasingMeta() { - return 4; + return 6; } public byte getCasingMeta2() { - return 5; + return 8; } public byte getCasingMeta3() { - return 6; + return 7; } - public boolean isValidCasingBlock(Block aBlock, int aMeta) { - if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) { - return true; - } - if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) { - return true; - } - if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) { - return true; - } - Logger.INFO("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + "With Meta "+aMeta); - return false; + public byte getCasingMeta4() { + return 11; } public byte getCasingTextureIndex() { @@ -254,7 +650,7 @@ extends GregtechMeta_MultiBlockBase { @Override public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (this.mHeight > 3) {} + } @@ -262,441 +658,48 @@ extends GregtechMeta_MultiBlockBase { @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setInteger("mHeight", mHeight); aNBT.setInteger("mHeatLevel", mHeatLevel); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - mHeight = aNBT.getInteger("mHeight"); mHeatLevel = aNBT.getInteger("mHeatLevel"); } - public boolean checkLayer(int aY) { - if (aY >= 0 && aY <= 6) { - return checkTopLayers(-aY); - } - if (aY >= 7 && aY <= 16) { - return checkTowerLayer(-aY); - } - else if (aY >= 17 && aY <= 19) { - return checkBaseLayer(-aY); - } - Logger.INFO("Bad Y level to check"); - return false; - } - - public boolean checkTopLayers(int aY) { - Block aBlock; - int aMeta; - - if (aY == 0) { - return true; - } else if (aY == -1) { - for (int x = -1; x <= 1; x++) { - for (int z = -1; z <= 1; z++) { - aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); - aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } - } - } else if (aY == -2 || aY == -6) { - for (int x = -2; x <= 2; x++) { - for (int z = -2; z <= 2; z++) { - aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); - aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - //Edge Casing - if (x == -2 || x == 2 || z == -2 || z == 2) { - //Edge Corners - if ((x == 2 || x == -2) && (z == 2 | z == -2)) { - if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - else { - continue; - } - } - else { - //Edge Sides - if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } - } - - //Internal - else { - if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } - } - } - } - //Top Layers 7x7 - else if (aY == -3 || aY == -5) { - for (int x = -3; x <= 3; x++) { - for (int z = -3; z <= 3; z++) { - aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); - aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - //Edge Casing - if (x == -3 || x == 3 || z == -3 || z == 3) { - - //3, 3 - //2, 3 - //3, 2 - - //Air Spacing - if (x == 3 && (z == -3 || z == -2 || z == 2 || z == 3)) { - if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - else { - continue; - } - } - else if (x == -3 && (z == -3 || z == -2 || z == 2 || z == 3)) { - if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - else { - continue; - } - } - else if (z == 3 && (x == -3 || x == -2 || x == 2 || x == 3)) { - if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - else { - continue; - } - } - else if (z == -3 && (x == -3 || x == -2 || x == 2 || x == 3)) { - if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block on Outside Corner "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - else { - continue; - } - } - else { - //Edge Sides - if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } - } - else if ((x == -2 || x == 2) & (z == -2 || z == 2)) { - if (aBlock == getCasingBlock() && aMeta == getCasingMeta3()) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } - //Internal - else { - if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } - } - } - } - //Midle Top Layer 9x9 - else if (aY == -4) { - //Check Inner 5x5 - for (int x = -2; x <= 2; x++) { - for (int z = -2; z <= 2; z++) { - if (getBaseMetaTileEntity().getBlockOffset(x, aY, z) != getCasingBlock() && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z) != getCasingMeta2()) { - Logger.INFO("Error at offset: X:" + x + ", Y:" + aY + ", Z:" + z); - return false; - } - else { - continue; - } - } - } - //Check Pos Sides - for (int z = -1; z <= -1; z++) { - if (getBaseMetaTileEntity().getBlockOffset(3, aY, z) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(3, aY, z) == getCasingMeta2()) { - continue; - } else if (getBaseMetaTileEntity().getBlockOffset(-3, aY, z) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(-3, aY, z) == getCasingMeta2()) { - continue; - } else { - Logger.INFO("1 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z); - return false; - } - - } - for (int x = -1; x <= -1; x++) { - if (getBaseMetaTileEntity().getBlockOffset(x, aY, 3) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 3) == getCasingMeta2()) { - continue; - } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -3) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -3) == getCasingMeta2()) { - continue; - } else { - Logger.INFO("1 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3"); - return false; - } - } - - //Corner Casings - for (int z = -2; z <= -2; z++) { - if (z == -2 || z == 2) { - if (getBaseMetaTileEntity().getBlockOffset(3, aY, z) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(3, aY, z) == getCasingMeta3()) { - continue; - } else if (getBaseMetaTileEntity().getBlockOffset(-3, aY, z) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(-3, aY, z) == getCasingMeta3()) { - continue; - } else { - Logger.INFO("2 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z); - return false; - } - } - } - for (int x = -2; x <= -2; x++) { - if (x == -2 || x == 2) { - if (getBaseMetaTileEntity().getBlockOffset(x, aY, 3) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 3) == getCasingMeta3()) { - continue; - } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -3) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -3) == getCasingMeta3()) { - continue; - } else { - Logger.INFO("2 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3"); - return false; - } - } - } - //Check Sides Casings - for (int z = -1; z <= -1; z++) { - if (getBaseMetaTileEntity().getBlockOffset(4, aY, z) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(4, aY, z) == getCasingMeta3()) { - continue; - } else if (getBaseMetaTileEntity().getBlockOffset(-4, aY, z) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(-4, aY, z) == getCasingMeta3()) { - continue; - } else { - Logger.INFO("1 Error at offset: X:3/-3" + ", Y:" + aY + ", Z:" + z); - return false; - } - - } - for (int x = -1; x <= -1; x++) { - if (getBaseMetaTileEntity().getBlockOffset(x, aY, 4) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, 4) == getCasingMeta3()) { - continue; - } else if (getBaseMetaTileEntity().getBlockOffset(x, aY, -4) == getCasingBlock() - && this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, -4) == getCasingMeta3()) { - continue; - } else { - Logger.INFO("1 Error at offset: X:" + x + ", Y:" + aY + ", Z:3/-3"); - return false; - } - } - } - return true; - } - - public boolean checkTowerLayer(int aY) { - Block aBlock; - int aMeta; - for (int x = -1; x <= 1; x++) { - for (int z = -1; z <= 1; z++) { - aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); - aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - if (x == -1 || x == 1 || z == -1 || z == 1) { - if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block Externally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } else { - if (aBlock == getCasingBlock() && aMeta == getCasingMeta2()) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } - } - } - return true; - } - - public boolean checkBaseLayer(int aY) { - Block aBlock; - int aMeta; - - int requiredMeta = getCasingMeta2(); - if (aY == -19) { - requiredMeta = getCasingMeta(); - } - - for (int x = -3; x <= 3; x++) { - for (int z = -3; z <= 3; z++) { - aBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); - aMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - - if ((x == 3 && z == 3) || (x == 2 && z == 2) || (x == 3 && z == 2) || (x == 2 && z == 3)) { - if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - return false; - } - } - else if ((x == -3 && z == -3) || (x == -2 && z == -2) || (x == -3 && z == -2) || (x == -2 && z == -3)) { - if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - return false; - } - } - else if ((x == -3 && z == 3) || (x == -2 && z == 2) || (x == -3 && z == 2) || (x == -2 && z == 3)) { - if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - return false; - } - } - else if ((x == 3 && z == -3) || (x == 2 && z == -2) || (x == 3 && z == -2) || (x == 2 && z == -3)) { - if (!getBaseMetaTileEntity().getAirOffset(x, aY, z)) { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - return false; - } - } - else { - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); - if (addToMachineList(tTileEntity, mCasingTextureID)) { - continue; - } - if (x == 0 && z == 0) { - if (aBlock == getCasingBlock() && aMeta == requiredMeta) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } - else { - if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) { - continue; - } else { - Logger.INFO("Error at offset: X:"+x+", Y:"+aY+", Z:"+z); - Logger.INFO("Found Bad Block Internally on Layer "+aY+": "+(aBlock != null ? aBlock.getLocalizedName() : "Air")+" | Meta: "+aMeta); - return false; - } - } - } - } - } - return true; - } - @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - - //Add Heat every second - if (aTick % 20 == 0) { - - //Add Heat First, if sources available - int aCacheSize = this.mCachedReflectors.size(); - if (aCacheSize > 0) { - int aCount = aCacheSize; - for (int i = 0; i < aCount; i++) { - this.mHeatLevel++; - } - } - - //Remove Heat, based on time of day - World w = this.getBaseMetaTileEntity().getWorld(); - if (w != null) { - int aRemovalFactor = 0; - if (w.isDaytime()) { - aRemovalFactor = 1; - } - else { - aRemovalFactor = 3; - } - for (int i = 0; i<MathUtils.randInt((aCacheSize/10), (aCacheSize*10)); i++){ - this.mHeatLevel -= aRemovalFactor; - } - } - } } @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPreTick(aBaseMetaTileEntity, aTick); - if (this.mCachedReflectors.isEmpty()) { - if (aTick % (30*20) == 0) { - this.getConnectedSolarReflectors(); - } - } + super.onPreTick(aBaseMetaTileEntity, aTick); + // Fix GT bug + if (this.getBaseMetaTileEntity().getFrontFacing() != 1) { + this.getBaseMetaTileEntity().setFrontFacing((byte) 1); + } } @Override public void onRemoval() { - this.mCachedReflectors.clear(); + resetSolarHeaters(); super.onRemoval(); } + private void resetSolarHeaters() { + for (TileEntitySolarHeater aTile : this.mSolarHeaters) { + aTile.clearSolarTower(); + } + this.mSolarHeaters.clear(); + } + @Override public String[] getExtraInfoData() { return new String[] { "Internal Heat Level: "+this.mHeatLevel, - "Connected Solar Reflectors: "+this.mCachedReflectors.size() + "Connected Solar Reflectors: "+this.mSolarHeaters.size() }; } - - - - - - - - } -*/ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java index 5d8e9d468d..4b73bba6df 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/misc/TileEntitySolarHeater.java @@ -1,4 +1,3 @@ -/* package gtPlusPlus.xmod.gregtech.common.tileentities.misc; import gregtech.api.enums.Textures; @@ -13,16 +12,18 @@ import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_SolarTower; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock { - public String mSolarTower; public boolean mHasTower = false; - - private Integer mTX, mTY, mTZ; + private GregtechMetaTileEntity_SolarTower mTower = null; + + private int mTX, mTY, mTZ; private Byte mRequiredFacing; public TileEntitySolarHeater(final int aID, final String aName, final String aNameRegional, final int aTier, @@ -88,7 +89,8 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock } public ITexture[] getSides(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) }; + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top), + new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) }; } public ITexture[] getFrontActive(final byte aColor) { @@ -110,7 +112,8 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock } public ITexture[] getSidesActive(final byte aColor) { - return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top) }; + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Machine_Simple_Top), + new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV) }; } @Override @@ -223,7 +226,7 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock @Override public void saveNBTData(NBTTagCompound aNBT) { aNBT.setBoolean("mHasTower", mHasTower); - if (mHasTower && mTX != null && mTY != null && mTZ != null) { + if (mHasTower) { aNBT.setInteger("mTX", mTX); aNBT.setInteger("mTY", mTY); aNBT.setInteger("mTZ", mTZ); @@ -262,57 +265,55 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock public void onExplosion() { } - + + public boolean hasSolarTower() { + return mHasTower; + } + public GregtechMetaTileEntity_SolarTower getSolarTower() { - if (this.mHasTower && this.mSolarTower != null && this.mSolarTower.length() > 0) { - BlockPos p = BlockPos.generateBlockPos(mSolarTower); - if (p != null) { - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(p.xPos, p.yPos, p.zPos); - if (tTileEntity != null && tTileEntity instanceof GregtechMetaTileEntity_SolarTower) { - return (GregtechMetaTileEntity_SolarTower) tTileEntity; - } - } + if (this.mHasTower) { + return mTower; } return null; } + public boolean canSeeSky() { + if (this.getBaseMetaTileEntity().getWorld().canBlockSeeTheSky(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord())) { + return true; + } + return false; + } - public boolean setSolarTower(BlockPos aTowerPos) { - if (!this.mHasTower && setSolarTowerInternal(aTowerPos.getUniqueIdentifier())) { - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(aTowerPos.xPos, aTowerPos.yPos, aTowerPos.zPos); - if (tTileEntity != null && tTileEntity instanceof GregtechMetaTileEntity_SolarTower) { - this.mTX = tTileEntity.getXCoord(); - this.mTY = (int) tTileEntity.getYCoord(); - this.mTZ = tTileEntity.getZCoord(); - this.mHasTower = true; - return true; - } - } + + public boolean setSolarTower(GregtechMetaTileEntity_SolarTower aTowerTile) { + if (!hasSolarTower()) { + this.mTX = aTowerTile.getBaseMetaTileEntity().getXCoord(); + this.mTY = (int) aTowerTile.getBaseMetaTileEntity().getYCoord(); + this.mTZ = aTowerTile.getBaseMetaTileEntity().getZCoord(); + this.mHasTower = true; + this.mTower = aTowerTile; + return true; + } return false; } - - private boolean clearSolarTower() { - if (mHasTower || mTX != null || mTY != null || mTZ != null || mRequiredFacing != null || this.mSolarTower != null) { - this.mTX = null; - this.mTY = null; - this.mTZ = null; - this.mRequiredFacing = null; - this.mSolarTower = null; - this.mHasTower = false; - return true; - } - return false; - } - - private final boolean setSolarTowerInternal(String aTowerPos) { - this.mSolarTower = aTowerPos; - return this.mSolarTower != null && this.mSolarTower.length() > 0; + + public boolean clearSolarTower() { + if (mHasTower || mRequiredFacing != null || this.mTower != null) { + this.mTX = 0; + this.mTY = 0; + this.mTZ = 0; + this.mRequiredFacing = null; + this.mTower = null; + this.mHasTower = false; + return true; + } + return false; } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - + } @Override @@ -345,4 +346,3 @@ public class TileEntitySolarHeater extends GT_MetaTileEntity_TieredMachineBlock } } -*/ diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_Ex.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_Ex.java index e76b769ef6..141e75c8b5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_Ex.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_BlastSmelterGT_Ex.java @@ -47,7 +47,7 @@ public class RecipeGen_BlastSmelterGT_Ex implements IOreRecipeRegistrator { if (aMaterial.mBlastFurnaceRequired) { addBlastRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, null, null, aMaterial.mBlastFurnaceTemp > 1750 ? GT_OreDictUnificator.get(OrePrefixes.ingotHot, aMaterial.mSmeltInto, tDustStack, 1L) : GT_Utility.copyAmount(1L, new Object[]{tDustStack}), null, (int) Math.max(aMaterial.getMass() / 40L, 1L) * aMaterial.mBlastFurnaceTemp, 120, aMaterial); if (aMaterial.mBlastFurnaceTemp <= 1000) { - GT_ModHandler.addRCBlastFurnaceRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_Utility.copyAmount(1L, new Object[]{tDustStack}), aMaterial.mBlastFurnaceTemp); + //GT_ModHandler.addRCBlastFurnaceRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_Utility.copyAmount(1L, new Object[]{tDustStack}), aMaterial.mBlastFurnaceTemp); } } } @@ -83,8 +83,8 @@ public class RecipeGen_BlastSmelterGT_Ex implements IOreRecipeRegistrator { if (!aMaterial.contains(SubTag.NO_SMELTING)) { if ((aMaterial.mBlastFurnaceRequired) || (aMaterial.mDirectSmelting.mBlastFurnaceRequired)) { addBlastRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), null, null, null, aMaterial.mBlastFurnaceTemp > 1750 ? GT_OreDictUnificator.get(OrePrefixes.ingotHot, aMaterial, GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), 1L) : GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), null, (int) Math.max(aMaterial.getMass() / 4L, 1L) * aMaterial.mBlastFurnaceTemp, 120, aMaterial); - if (aMaterial.mBlastFurnaceTemp <= 1000) - GT_ModHandler.addRCBlastFurnaceRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), aMaterial.mBlastFurnaceTemp * 2); + //if (aMaterial.mBlastFurnaceTemp <= 1000) + //GT_ModHandler.addRCBlastFurnaceRecipe(GT_Utility.copyAmount(1L, new Object[]{aStack}), GT_OreDictUnificator.get(OrePrefixes.ingot, aMaterial, 1L), aMaterial.mBlastFurnaceTemp * 2); } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java index 6af1515c05..67c54a7699 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java @@ -1,9 +1,10 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialVacuumFreezer; -//import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_AssemblyLine; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_AssemblyLine; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_DistillationTower; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_EBF; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4; @@ -25,9 +26,9 @@ public class GregtechFactoryGradeReplacementMultis { //31021 GregtechItemList.Machine_Adv_DistillationTower.set(new GregtechMetaTileEntity_Adv_DistillationTower(31021, "multimachine.adv.distillationtower", "Dangote Distillus").getStackForm(1L)); - /*if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { GregtechItemList.Machine_Adv_AssemblyLine.set(new GregtechMetaTileEntity_Adv_AssemblyLine(31024, "multimachine.adv.assemblyline", "Compound Fabricator").getStackForm(1L)); - }*/ + } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarTower.java index d7f8f7f4d5..b4cdf581ae 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSolarTower.java @@ -1,10 +1,12 @@ -/* package gtPlusPlus.xmod.gregtech.registration.gregtech; +import gregtech.api.util.GTPP_Recipe; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.material.MISC_MATERIALS; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_SolarTower; import gtPlusPlus.xmod.gregtech.common.tileentities.misc.TileEntitySolarHeater; +import net.minecraftforge.fluids.FluidStack; public class GregtechSolarTower { @@ -28,5 +30,20 @@ public class GregtechSolarTower { "Part of the Clean Green energy movement", 0).getStackForm(1L)); + // NEI recipe + GTPP_Recipe aRecipe = new GTPP_Recipe( + false, + null, + null, + null, + null, + new FluidStack[] {MISC_MATERIALS.SOLAR_SALT_COLD.getFluidStack(1000)}, + new FluidStack[] {MISC_MATERIALS.SOLAR_SALT_HOT.getFluidStack(1000)}, + 0, + 0, + 0); + GTPP_Recipe.GTPP_Recipe_Map.sSolarTowerRecipes.add(aRecipe); + + } -}*/ +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTeslaTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTeslaTower.java index 1c5181130b..5023e80543 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTeslaTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTeslaTower.java @@ -1,4 +1,3 @@ -/* package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.api.objects.Logger; @@ -14,4 +13,3 @@ public class GregtechTeslaTower { } } -*/ |