diff --git a/src/main/java/bartworks/MainMod.java b/src/main/java/bartworks/MainMod.java index acf652c352d..66eec8469bd 100644 --- a/src/main/java/bartworks/MainMod.java +++ b/src/main/java/bartworks/MainMod.java @@ -72,6 +72,7 @@ import gregtech.api.enums.Mods; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResultRegistry; +import tectech.loader.recipe.Godforge; @Mod( modid = MainMod.MOD_ID, @@ -202,7 +203,6 @@ public static void runOnPlayerJoined(boolean classicMode, boolean disableExtraGa BioVatLogicAdder.RadioHatch.runBasicItemIntegration(); if (!recipesAdded) { StaticRecipeChangeLoaders.addEBFGasRecipes(); - recipesAdded = true; } // Accept recipe map changes into Buffers @@ -210,5 +210,10 @@ public static void runOnPlayerJoined(boolean classicMode, boolean disableExtraGa .forEach( map -> map.getBackend() .reInit()); + + // because the above code runs so late that I couldn't find anywhere else to call this + if (!recipesAdded) Godforge.initMoltenModuleRecipes(); + + recipesAdded = true; } } diff --git a/src/main/java/gregtech/api/util/GTRecipeConstants.java b/src/main/java/gregtech/api/util/GTRecipeConstants.java index 98be4718a09..dfaaff87139 100644 --- a/src/main/java/gregtech/api/util/GTRecipeConstants.java +++ b/src/main/java/gregtech/api/util/GTRecipeConstants.java @@ -124,6 +124,12 @@ public class GTRecipeConstants { public static final RecipeMetadataKey FOG_PLASMA_TIER = SimpleRecipeMetadataKey .create(Integer.class, "fog_plasma_tier"); + /** + * FOG Plasma multistep requirement. + */ + public static final RecipeMetadataKey FOG_PLASMA_MULTISTEP = SimpleRecipeMetadataKey + .create(Boolean.class, "fog_plasma_multistep"); + /** * DEFC Casing tier. */ diff --git a/src/main/java/gregtech/loaders/postload/recipes/BlastFurnaceRecipes.java b/src/main/java/gregtech/loaders/postload/recipes/BlastFurnaceRecipes.java index 478b6f15143..7be5ca5940d 100644 --- a/src/main/java/gregtech/loaders/postload/recipes/BlastFurnaceRecipes.java +++ b/src/main/java/gregtech/loaders/postload/recipes/BlastFurnaceRecipes.java @@ -13,6 +13,7 @@ import net.minecraftforge.fluids.FluidStack; import bartworks.system.material.WerkstoffLoader; +import goodgenerator.items.GGMaterial; import gregtech.GTMod; import gregtech.api.enums.GTValues; import gregtech.api.enums.ItemList; @@ -664,6 +665,20 @@ public void registerBlastFurnaceRecipes() { .metadata(COIL_HEAT, 17000) .addTo(blastFurnaceRecipes); + GTValues.RA.stdBuilder() + .itemInputs( + ItemList.Phononic_Seed_Crystal.get(2), + MaterialsUEVplus.Eternity.getDust(8), + GGMaterial.shirabon.get(OrePrefixes.dust, 8), + GTUtility.getIntegratedCircuit(2)) + .fluidInputs(MaterialsUEVplus.Mellion.getMolten(512 * 144L)) + .fluidOutputs(MaterialsUEVplus.PhononCrystalSolution.getFluid(3000)) + .duration(200 * SECONDS) + .eut((int) TierEU.RECIPE_UXV) + .metadata(COIL_HEAT, 50000) + .noOptimize() + .addTo(blastFurnaceRecipes); + GTValues.RA.stdBuilder() .itemInputs(MaterialsUEVplus.Mellion.getDust(1), GTUtility.getIntegratedCircuit(11)) .itemOutputs(GTOreDictUnificator.get(OrePrefixes.ingotHot, MaterialsUEVplus.Mellion, 1)) diff --git a/src/main/java/tectech/loader/TecTechConfig.java b/src/main/java/tectech/loader/TecTechConfig.java index 7bf7eef72bb..9c9425a9c99 100644 --- a/src/main/java/tectech/loader/TecTechConfig.java +++ b/src/main/java/tectech/loader/TecTechConfig.java @@ -13,11 +13,6 @@ public TecTechConfig(File pConfigBaseDirectory, String pModCollectionDirectory, // final static to allow compiler to remove the debug code when this is false public static boolean DEBUG_MODE = false; public static boolean POWERLESS_MODE = false; - /** - * Not complete; enabled by default only in dev env - */ - public boolean ENABLE_GOD_FORGE; - public boolean BOOM_ENABLE; public boolean DISABLE_BLOCK_HARDNESS_NERF; public boolean EASY_SCAN; diff --git a/src/main/java/tectech/loader/recipe/BaseRecipeLoader.java b/src/main/java/tectech/loader/recipe/BaseRecipeLoader.java index 8b6c40c6f86..9e08460fb6e 100644 --- a/src/main/java/tectech/loader/recipe/BaseRecipeLoader.java +++ b/src/main/java/tectech/loader/recipe/BaseRecipeLoader.java @@ -42,7 +42,6 @@ public void run() { new Crafting().run(); new Extractor().run(); new ResearchStationAssemblyLine().run(); - } else { new Godforge().run(); } } diff --git a/src/main/java/tectech/loader/recipe/Godforge.java b/src/main/java/tectech/loader/recipe/Godforge.java index 7bd94d2c770..414756a036e 100644 --- a/src/main/java/tectech/loader/recipe/Godforge.java +++ b/src/main/java/tectech/loader/recipe/Godforge.java @@ -3,9 +3,13 @@ import static gregtech.api.enums.Mods.EternalSingularity; import static gregtech.api.enums.Mods.GalaxySpace; import static gregtech.api.util.GTModHandler.getModItem; +import static gregtech.api.util.GTRecipeBuilder.BUCKETS; +import static gregtech.api.util.GTRecipeBuilder.INGOTS; import static gregtech.api.util.GTRecipeBuilder.SECONDS; import static gregtech.api.util.GTRecipeBuilder.TICKS; +import static gregtech.api.util.GTRecipeConstants.COIL_HEAT; import static gregtech.api.util.GTRecipeConstants.FOG_EXOTIC_TIER; +import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_MULTISTEP; import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_TIER; import static tectech.recipe.TecTechRecipeMaps.godforgeExoticMatterRecipes; import static tectech.recipe.TecTechRecipeMaps.godforgePlasmaRecipes; @@ -17,7 +21,9 @@ import java.util.List; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.oredict.OreDictionary; import goodgenerator.items.GGMaterial; import goodgenerator.util.ItemRefer; @@ -27,11 +33,18 @@ import gregtech.api.enums.MaterialsUEVplus; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.TierEU; +import gregtech.api.objects.ItemData; +import gregtech.api.recipe.RecipeMaps; import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTRecipeBuilder; import gregtech.api.util.GTUtility; import gtPlusPlus.core.material.MaterialsAlloy; import gtPlusPlus.core.material.MaterialsElements; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import tectech.recipe.TecTechRecipeMaps; import tectech.thing.CustomItemList; public class Godforge implements Runnable { @@ -48,6 +61,20 @@ public class Godforge implements Runnable { public static final List magmatterSpaceFluidItemsForNEI = new ArrayList<>(); public static final List magmatterItemsForNEI = new ArrayList<>(); + private FluidStack[] convertToFluid(ItemStack[] items) { + List molten = new ArrayList<>(); + + for (ItemStack itemStack : items) { + String dict = OreDictionary.getOreName(OreDictionary.getOreIDs(itemStack)[0]); + // substring 4 because dust is 4 characters long and there is no other possible oreDict + String strippedOreDict = dict.substring(4); + molten.add(FluidRegistry.getFluidStack("molten." + strippedOreDict.toLowerCase(), 144)); + + } + + return molten.toArray(new FluidStack[0]); + } + @Override public void run() { // Solid to plasma recipes @@ -85,6 +112,9 @@ public void run() { MaterialsElements.getInstance().IODINE.getDust(1), MaterialsElements.getInstance().HAFNIUM.getDust(1), MaterialsElements.getInstance().CURIUM.getDust(1) }; + + FluidStack[] molten_t0_1step = convertToFluid(solids_t0_1step); + FluidStack[] solid_plasmas_t0_1step = { Materials.Aluminium.getPlasma(144), Materials.Iron.getPlasma(144), Materials.Calcium.getPlasma(144), Materials.Sulfur.getPlasma(144), Materials.Zinc.getPlasma(144), Materials.Niobium.getPlasma(144), Materials.Tin.getPlasma(144), @@ -124,143 +154,220 @@ public void run() { new FluidStack(MaterialsElements.getInstance().CURIUM.getPlasma(), 144) }; for (int i = 0; i < solids_t0_1step.length; i++) { - boolean multistep = false; GTValues.RA.stdBuilder() .itemInputs(solids_t0_1step[i]) .fluidOutputs(solid_plasmas_t0_1step[i]) .duration(10 * TICKS) .eut(TierEU.RECIPE_MAX) - .special(multistep) + .metadata(FOG_PLASMA_MULTISTEP, false) .metadata(FOG_PLASMA_TIER, 0) .noOptimize() .addTo(godforgePlasmaRecipes); + + if (molten_t0_1step[i] != null) { + GTValues.RA.stdBuilder() + .fluidInputs(molten_t0_1step[i]) + .fluidOutputs(solid_plasmas_t0_1step[i]) + .duration(10 * TICKS) + .eut(TierEU.RECIPE_MAX) + .metadata(FOG_PLASMA_MULTISTEP, false) + .metadata(FOG_PLASMA_TIER, 0) + .noOptimize() + .addTo(godforgePlasmaRecipes); + } } + } - // Multi-step - ItemStack[] solids_t0_xstep = { Materials.Force.getDust(1), Materials.Bismuth.getDust(1), - MaterialsElements.STANDALONE.ADVANCED_NITINOL.getDust(1), Materials.Boron.getDust(1), - MaterialsElements.STANDALONE.ASTRAL_TITANIUM.getDust(1), - MaterialsElements.STANDALONE.RUNITE.getDust(1), - MaterialsElements.STANDALONE.CELESTIAL_TUNGSTEN.getDust(1), Materials.Iridium.getDust(1), - Materials.Naquadah.getDust(1), Materials.Osmium.getDust(1), Materials.Platinum.getDust(1), - Materials.Plutonium.getDust(1), MaterialsElements.getInstance().CALIFORNIUM.getDust(1), - Materials.Chrome.getDust(1) }; - FluidStack[] solid_plasmas_t0_xstep = { - new FluidStack(MaterialsElements.STANDALONE.FORCE.getPlasma(), 144), - Materials.Bismuth.getPlasma(144), - new FluidStack(MaterialsElements.STANDALONE.ADVANCED_NITINOL.getPlasma(), 144), - Materials.Boron.getPlasma(144), - new FluidStack(MaterialsElements.STANDALONE.ASTRAL_TITANIUM.getPlasma(), 144), - new FluidStack(MaterialsElements.STANDALONE.RUNITE.getPlasma(), 144), - new FluidStack(MaterialsElements.STANDALONE.CELESTIAL_TUNGSTEN.getPlasma(), 144), - Materials.Iridium.getPlasma(144), Materials.Naquadah.getPlasma(144), - Materials.Osmium.getPlasma(144), Materials.Platinum.getPlasma(144), - Materials.Plutonium.getPlasma(144), - new FluidStack(MaterialsElements.getInstance().CALIFORNIUM.getPlasma(), 144), - Materials.Chrome.getPlasma(144), }; - - for (int i = 0; i < solids_t0_xstep.length; i++) { - boolean multistep = true; + // Multi-step + ItemStack[] solids_t0_xstep = { Materials.Force.getDust(1), Materials.Bismuth.getDust(1), + MaterialsElements.STANDALONE.ADVANCED_NITINOL.getDust(1), Materials.Boron.getDust(1), + MaterialsElements.STANDALONE.ASTRAL_TITANIUM.getDust(1), MaterialsElements.STANDALONE.RUNITE.getDust(1), + MaterialsElements.STANDALONE.CELESTIAL_TUNGSTEN.getDust(1), Materials.Iridium.getDust(1), + Materials.Naquadah.getDust(1), Materials.Osmium.getDust(1), Materials.Platinum.getDust(1), + Materials.Plutonium.getDust(1), MaterialsElements.getInstance().CALIFORNIUM.getDust(1), + Materials.Chrome.getDust(1) }; + + FluidStack[] molten_t0_xstep = convertToFluid(solids_t0_xstep); + + FluidStack[] solid_plasmas_t0_xstep = { new FluidStack(MaterialsElements.STANDALONE.FORCE.getPlasma(), 144), + Materials.Bismuth.getPlasma(144), + new FluidStack(MaterialsElements.STANDALONE.ADVANCED_NITINOL.getPlasma(), 144), + Materials.Boron.getPlasma(144), + new FluidStack(MaterialsElements.STANDALONE.ASTRAL_TITANIUM.getPlasma(), 144), + new FluidStack(MaterialsElements.STANDALONE.RUNITE.getPlasma(), 144), + new FluidStack(MaterialsElements.STANDALONE.CELESTIAL_TUNGSTEN.getPlasma(), 144), + Materials.Iridium.getPlasma(144), Materials.Naquadah.getPlasma(144), Materials.Osmium.getPlasma(144), + Materials.Platinum.getPlasma(144), Materials.Plutonium.getPlasma(144), + new FluidStack(MaterialsElements.getInstance().CALIFORNIUM.getPlasma(), 144), + Materials.Chrome.getPlasma(144), }; + + for (int i = 0; i < solids_t0_xstep.length; i++) { + GTValues.RA.stdBuilder() + .itemInputs(solids_t0_xstep[i]) + .fluidOutputs(solid_plasmas_t0_xstep[i]) + .duration(2 * SECONDS) + .eut(TierEU.RECIPE_MAX) + .metadata(FOG_PLASMA_MULTISTEP, true) + .metadata(FOG_PLASMA_TIER, 0) + .noOptimize() + .addTo(godforgePlasmaRecipes); + + if (molten_t0_xstep[i] != null) { GTValues.RA.stdBuilder() - .itemInputs(solids_t0_xstep[i]) + .fluidInputs(molten_t0_xstep[i]) .fluidOutputs(solid_plasmas_t0_xstep[i]) .duration(2 * SECONDS) .eut(TierEU.RECIPE_MAX) - .special(multistep) + .metadata(FOG_PLASMA_MULTISTEP, true) .metadata(FOG_PLASMA_TIER, 0) .noOptimize() .addTo(godforgePlasmaRecipes); } } - // Fusion tier 4-5 - { - // Single step - ItemStack[] solids_t1_1step = { Materials.Lead.getDust(1), Materials.Plutonium241.getDust(1), - Materials.Thorium.getDust(1), Materials.Naquadria.getDust(1) }; - FluidStack[] solid_plasmas_t1_1step = { Materials.Lead.getPlasma(144), - Materials.Plutonium241.getPlasma(144), Materials.Thorium.getPlasma(144), - Materials.Naquadria.getPlasma(144) }; + } + // Fusion tier 4-5 + { + // Single step + ItemStack[] solids_t1_1step = { Materials.Lead.getDust(1), Materials.Plutonium241.getDust(1), + Materials.Thorium.getDust(1), Materials.Naquadria.getDust(1) }; + + FluidStack[] molten_t1_1step = convertToFluid(solids_t1_1step); + + FluidStack[] solid_plasmas_t1_1step = { Materials.Lead.getPlasma(144), + Materials.Plutonium241.getPlasma(144), Materials.Thorium.getPlasma(144), + Materials.Naquadria.getPlasma(144) }; + + for (int i = 0; i < solids_t1_1step.length; i++) { + GTValues.RA.stdBuilder() + .itemInputs(solids_t1_1step[i]) + .fluidOutputs(solid_plasmas_t1_1step[i]) + .duration(5 * SECONDS) + .eut(TierEU.RECIPE_MAX) + .metadata(FOG_PLASMA_MULTISTEP, false) + .metadata(FOG_PLASMA_TIER, 1) + .noOptimize() + .addTo(godforgePlasmaRecipes); + + if (molten_t1_1step[i] != null) { - for (int i = 0; i < solids_t1_1step.length; i++) { - boolean multistep = false; GTValues.RA.stdBuilder() - .itemInputs(solids_t1_1step[i]) + .fluidInputs(molten_t1_1step[i]) .fluidOutputs(solid_plasmas_t1_1step[i]) .duration(5 * SECONDS) .eut(TierEU.RECIPE_MAX) - .special(multistep) + .metadata(FOG_PLASMA_MULTISTEP, false) .metadata(FOG_PLASMA_TIER, 1) .noOptimize() .addTo(godforgePlasmaRecipes); } + } - // Multi-step - ItemStack[] solids_t1_xstep = { MaterialsElements.getInstance().NEPTUNIUM.getDust(1), - MaterialsElements.getInstance().FERMIUM.getDust(1) }; - FluidStack[] solid_plasmas_t1_xstep = { - new FluidStack(MaterialsElements.getInstance().NEPTUNIUM.getPlasma(), 144), - new FluidStack(MaterialsElements.getInstance().FERMIUM.getPlasma(), 144) }; + // Multi-step + ItemStack[] solids_t1_xstep = { MaterialsElements.getInstance().NEPTUNIUM.getDust(1), + MaterialsElements.getInstance().FERMIUM.getDust(1) }; - for (int i = 0; i < solids_t1_xstep.length; i++) { - boolean multistep = true; + FluidStack[] molten_t1_xstep = convertToFluid(solids_t1_xstep); + + FluidStack[] solid_plasmas_t1_xstep = { + new FluidStack(MaterialsElements.getInstance().NEPTUNIUM.getPlasma(), 144), + new FluidStack(MaterialsElements.getInstance().FERMIUM.getPlasma(), 144) }; + + for (int i = 0; i < solids_t1_xstep.length; i++) { + GTValues.RA.stdBuilder() + .itemInputs(solids_t1_xstep[i]) + .fluidOutputs(solid_plasmas_t1_xstep[i]) + .duration(7 * SECONDS) + .eut(TierEU.RECIPE_MAX) + .metadata(FOG_PLASMA_MULTISTEP, true) + .metadata(FOG_PLASMA_TIER, 1) + .noOptimize() + .addTo(godforgePlasmaRecipes); + + if (molten_t1_xstep[i] != null) { GTValues.RA.stdBuilder() - .itemInputs(solids_t1_xstep[i]) + .fluidInputs(molten_t1_xstep[i]) .fluidOutputs(solid_plasmas_t1_xstep[i]) .duration(7 * SECONDS) .eut(TierEU.RECIPE_MAX) - .special(multistep) + .metadata(FOG_PLASMA_MULTISTEP, true) .metadata(FOG_PLASMA_TIER, 1) .noOptimize() .addTo(godforgePlasmaRecipes); } } - // Exotic Plasmas - { - // Single step - ItemStack[] solids_t2_1step = { MaterialsElements.STANDALONE.RHUGNOR.getDust(1), - MaterialsElements.STANDALONE.DRAGON_METAL.getDust(1), - MaterialsElements.STANDALONE.CHRONOMATIC_GLASS.getDust(1), Materials.CosmicNeutronium.getDust(1), - Materials.Draconium.getDust(1), Materials.DraconiumAwakened.getDust(1), - Materials.Ichorium.getDust(1), Materials.Bedrockium.getDust(1) }; - FluidStack[] solid_plasmas_t2_1step = { - new FluidStack(MaterialsElements.STANDALONE.RHUGNOR.getPlasma(), 144), - new FluidStack(MaterialsElements.STANDALONE.DRAGON_METAL.getPlasma(), 144), - new FluidStack(MaterialsElements.STANDALONE.CHRONOMATIC_GLASS.getPlasma(), 144), - Materials.CosmicNeutronium.getPlasma(144), Materials.Draconium.getPlasma(144), - Materials.DraconiumAwakened.getPlasma(144), Materials.Ichorium.getPlasma(144), - Materials.Bedrockium.getPlasma(144), }; - - for (int i = 0; i < solids_t2_1step.length; i++) { - boolean multistep = false; + } + // Exotic Plasmas + { + // Single step + ItemStack[] solids_t2_1step = { MaterialsElements.STANDALONE.RHUGNOR.getDust(1), + MaterialsElements.STANDALONE.DRAGON_METAL.getDust(1), + MaterialsElements.STANDALONE.CHRONOMATIC_GLASS.getDust(1), Materials.CosmicNeutronium.getDust(1), + Materials.Draconium.getDust(1), Materials.DraconiumAwakened.getDust(1), Materials.Ichorium.getDust(1) }; + + FluidStack[] molten_t2_1step = convertToFluid(solids_t2_1step); + + FluidStack[] solid_plasmas_t2_1step = { + new FluidStack(MaterialsElements.STANDALONE.RHUGNOR.getPlasma(), 144), + new FluidStack(MaterialsElements.STANDALONE.DRAGON_METAL.getPlasma(), 144), + new FluidStack(MaterialsElements.STANDALONE.CHRONOMATIC_GLASS.getPlasma(), 144), + Materials.CosmicNeutronium.getPlasma(144), Materials.Draconium.getPlasma(144), + Materials.DraconiumAwakened.getPlasma(144), Materials.Ichorium.getPlasma(144) }; + + for (int i = 0; i < solids_t2_1step.length; i++) { + GTValues.RA.stdBuilder() + .itemInputs(solids_t2_1step[i]) + .fluidOutputs(solid_plasmas_t2_1step[i]) + .duration(15 * SECONDS) + .eut(TierEU.RECIPE_MAX) + .metadata(FOG_PLASMA_MULTISTEP, false) + .metadata(FOG_PLASMA_TIER, 2) + .noOptimize() + .addTo(godforgePlasmaRecipes); + + if (molten_t2_1step[i] != null) { + GTValues.RA.stdBuilder() - .itemInputs(solids_t2_1step[i]) + .fluidInputs(molten_t2_1step[i]) .fluidOutputs(solid_plasmas_t2_1step[i]) .duration(15 * SECONDS) .eut(TierEU.RECIPE_MAX) - .special(multistep) + .metadata(FOG_PLASMA_MULTISTEP, false) .metadata(FOG_PLASMA_TIER, 2) .noOptimize() .addTo(godforgePlasmaRecipes); } + } + + // Multi-step + ItemStack[] solids_t2_xstep = { MaterialsElements.STANDALONE.HYPOGEN.getDust(1), + Materials.Tritanium.getDust(1), Materials.Flerovium.getDust(1), Materials.Neutronium.getDust(1) }; + + FluidStack[] molten_t2_xstep = convertToFluid(solids_t2_xstep); + + FluidStack[] solid_plasmas_t2_xstep = { + new FluidStack(MaterialsElements.STANDALONE.HYPOGEN.getPlasma(), 144), + Materials.Tritanium.getPlasma(144), Materials.Flerovium.getPlasma(144), + Materials.Neutronium.getPlasma(144), }; + + for (int i = 0; i < solids_t2_xstep.length; i++) { + GTValues.RA.stdBuilder() + .itemInputs(solids_t2_xstep[i]) + .fluidOutputs(solid_plasmas_t2_xstep[i]) + .duration(25 * SECONDS) + .eut(TierEU.RECIPE_MAX) + .metadata(FOG_PLASMA_MULTISTEP, true) + .metadata(FOG_PLASMA_TIER, 2) + .noOptimize() + .addTo(godforgePlasmaRecipes); + + if (molten_t2_xstep[i] != null) { - // Multi-step - ItemStack[] solids_t2_xstep = { MaterialsElements.STANDALONE.HYPOGEN.getDust(1), - Materials.Tritanium.getDust(1), Materials.Flerovium.getDust(1), Materials.Neutronium.getDust(1), - Materials.Infinity.getDust(1), MaterialsUEVplus.SixPhasedCopper.getDust(1), }; - FluidStack[] solid_plasmas_t2_xstep = { - new FluidStack(MaterialsElements.STANDALONE.HYPOGEN.getPlasma(), 144), - Materials.Tritanium.getPlasma(144), Materials.Flerovium.getPlasma(144), - Materials.Neutronium.getPlasma(144), Materials.Infinity.getPlasma(144), - MaterialsUEVplus.SixPhasedCopper.getPlasma(144) }; - - for (int i = 0; i < solids_t2_xstep.length; i++) { - boolean multistep = true; GTValues.RA.stdBuilder() - .itemInputs(solids_t2_xstep[i]) + .fluidInputs(molten_t2_xstep[i]) .fluidOutputs(solid_plasmas_t2_xstep[i]) .duration(25 * SECONDS) .eut(TierEU.RECIPE_MAX) - .special(multistep) + .metadata(FOG_PLASMA_MULTISTEP, true) .metadata(FOG_PLASMA_TIER, 2) .noOptimize() .addTo(godforgePlasmaRecipes); @@ -373,15 +480,12 @@ public void run() { Materials.Arsenic, Materials.Barium, Materials.Beryllium, - Materials.Bismuth, - Materials.Boron, Materials.Caesium, Materials.Calcium, Materials.Cadmium, Materials.Carbon, Materials.Cerium, Materials.Chlorine, - Materials.Chrome, Materials.Cobalt, Materials.Copper, Materials.Desh, @@ -397,29 +501,21 @@ public void run() { Materials.Holmium, Materials.Hydrogen, Materials.Indium, - Materials.Iridium, Materials.Iron, Materials.Lanthanum, - Materials.Lead, Materials.Lithium, Materials.Lutetium, Materials.Magnesium, Materials.Manganese, Materials.MeteoricIron, Materials.Molybdenum, - Materials.Naquadah, Materials.Neodymium, Materials.Nickel, Materials.Niobium, Materials.Nitrogen, Materials.Oriharukon, - Materials.Osmium, - Materials.Oxygen, Materials.Palladium, Materials.Phosphorus, - Materials.Platinum, - Materials.Plutonium, - Materials.Plutonium241, Materials.Potassium, Materials.Praseodymium, Materials.Promethium, @@ -434,7 +530,6 @@ public void run() { Materials.Tantalum, Materials.Tellurium, Materials.Terbium, - Materials.Thorium, Materials.Thulium, Materials.Tin, Materials.Titanium, @@ -457,15 +552,12 @@ public void run() { 6000 /* Arsenic */, 6000 /* Barium */, 6000 /* Beryllium */, - 8000 /* Bismuth */, - 8000 /* Boron */, 6000 /* Caesium */, 10000 /* Calcium */, 6000 /* Cadmium */, 6000 /* Carbon */, 6000 /* Cerium */, 6000 /* Chlorine */, - 6000 /* Chrome */, 6000 /* Cobalt */, 6000 /* Copper */, 6000 /* Desh */, @@ -481,29 +573,21 @@ public void run() { 6000 /* Holmium */, 10000 /* Hydrogen */, 6000 /* Indium */, - 6000 /* Iridium */, 10000 /* Iron */, 6000 /* Lanthanum */, - 500 /* Lead */, 6000 /* Lithium */, 6000 /* Lutetium */, 6000 /* Magnesium */, 6000 /* Manganese */, 6000 /* Meteoric Iron */, 6000 /* Molybdenum */, - 6000 /* Naquadah */, 6000 /* Neodymium */, 10000 /* Nickel */, 10000 /* Niobium */, 10000 /* Nitrogen */, 6000 /* Oriharukon */, - 6000 /* Osmium */, - 8000 /* Oxygen */, 6000 /* Palladium */, 6000 /* Phosphorus */, - 6000 /* Platinum */, - 6000 /* Plutonium 239 */, - 500 /* Plutonium 241 */, 6000 /* Potassium */, 6000 /* Praseodymium */, 2000 /* Promethium */, @@ -518,7 +602,6 @@ public void run() { 6000 /* Tantalum */, 2000 /* Tellurium */, 1000 /* Terbium */, - 500 /* Thorium */, 6000 /* Thulium */, 10000 /* Tin */, 10000 /* Titanium */, @@ -540,20 +623,9 @@ public void run() { exoticModulePlasmaItemMap.put(MaterialsElements.getInstance().RHENIUM.getTinyDust(1), 2000); exoticModulePlasmaItemMap.put(MaterialsElements.getInstance().RHODIUM.getTinyDust(1), 6000); exoticModulePlasmaItemMap.put(MaterialsElements.getInstance().IODINE.getTinyDust(1), 6000); - exoticModulePlasmaItemMap.put(MaterialsElements.STANDALONE.ASTRAL_TITANIUM.getTinyDust(1), 8000); - exoticModulePlasmaItemMap.put(MaterialsElements.STANDALONE.ADVANCED_NITINOL.getTinyDust(1), 8000); - exoticModulePlasmaItemMap.put(MaterialsElements.STANDALONE.FORCE.getTinyDust(1), 8000); exoticModulePlasmaItemMap.put(MaterialsElements.getInstance().HAFNIUM.getTinyDust(1), 6000); - exoticModulePlasmaItemMap.put(MaterialsElements.getInstance().CALIFORNIUM.getTinyDust(1), 1000); - exoticModulePlasmaItemMap.put(MaterialsElements.STANDALONE.RUNITE.getTinyDust(1), 8000); - - exoticModulePlasmaFluidMap.put(new FluidStack(MaterialsElements.getInstance().XENON.getFluid(), 1), 8000); - exoticModulePlasmaFluidMap.put(new FluidStack(MaterialsElements.getInstance().KRYPTON.getFluid(), 1), 8000); - exoticModulePlasmaFluidMap.put(new FluidStack(MaterialsElements.getInstance().NEON.getFluid(), 1), 8000); - // These are here because they cant be solidified - exoticModulePlasmaFluidMap.put(new FluidStack(MaterialsElements.getInstance().CURIUM.getFluid(), 1), 10000); - exoticModulePlasmaFluidMap.put(new FluidStack(MaterialsElements.getInstance().NEPTUNIUM.getFluid(), 1), 800); - exoticModulePlasmaFluidMap.put(new FluidStack(MaterialsElements.getInstance().FERMIUM.getFluid(), 1), 800); + exoticModulePlasmaItemMap.put(MaterialsElements.getInstance().CURIUM.getTinyDust(1), 10000); + // Mercury is weird, it has neither dust nor gas, so it needs to be added separately exoticModulePlasmaFluidMap.put(Materials.Mercury.getFluid(1), 6000); @@ -652,7 +724,7 @@ public void run() { MaterialsElements.STANDALONE.HYPOGEN.getFrameBox(64), MaterialsElements.STANDALONE.DRAGON_METAL.getFrameBox(64), CustomItemList.EOH_Reinforced_Spatial_Casing.get(64), - CustomItemList.EOH_Infinite_Energy_Casing.get(8), ItemList.ZPM6.get(4), + CustomItemList.EOH_Infinite_Energy_Casing.get(8), ItemList.ZPM6.get(2), ItemList.Field_Generator_UMV.get(32) }); godforgeUpgradeMats.put( @@ -660,9 +732,9 @@ public void run() { new ItemStack[] { GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.WhiteDwarfMatter, 64), GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.BlackDwarfMatter, 64), GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.Eternity, 16), - GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.Universium, 4), + GTOreDictUnificator.get(OrePrefixes.frameGt, MaterialsUEVplus.Universium, 2), CustomItemList.EOH_Infinite_Energy_Casing.get(64), - CustomItemList.StabilisationFieldGeneratorTier5.get(16), ItemList.ZPM6.get(16), + CustomItemList.StabilisationFieldGeneratorTier5.get(16), ItemList.ZPM6.get(6), ItemList.Field_Generator_UMV.get(64) }); godforgeUpgradeMats.put( @@ -675,4 +747,80 @@ public void run() { } } + + public static void initMoltenModuleRecipes() { + for (GTRecipe recipe : RecipeMaps.blastFurnaceRecipes.getAllRecipes()) { + List itemOutputs = new ArrayList<>(1); + List fluidOutputs = new ArrayList<>(2); + + int[] originalChances = recipe.mChances; + IntList newChances = new IntArrayList(); + for (int i = 0; i < recipe.mOutputs.length; i++) { + ItemStack stack = recipe.getOutput(i); + if (stack == null) continue; + FluidStack potentialFluid = convertToMolten(stack); + if (potentialFluid != null) { + potentialFluid.amount *= stack.stackSize; + fluidOutputs.add(potentialFluid); + } else { + itemOutputs.add(stack); + if (originalChances != null) { + int chance = 10000; + if (originalChances.length > i) { + chance = originalChances[i]; + } + newChances.add(chance); + } + } + } + + fluidOutputs.addAll(Arrays.asList(recipe.mFluidOutputs)); + Integer heat = recipe.getMetadata(COIL_HEAT); + + GTRecipeBuilder builder = GTValues.RA.stdBuilder() + .noOptimize() + .itemOutputs(itemOutputs.toArray(new ItemStack[0])) + .fluidOutputs(fluidOutputs.toArray(new FluidStack[0])) + .duration(recipe.mDuration) + .eut(recipe.mEUt) + .specialValue(recipe.mSpecialValue); + + if (recipe.mInputs != null) builder.itemInputs(recipe.mInputs); + if (recipe.mFluidInputs != null) builder.fluidInputs(recipe.mFluidInputs); + if (!newChances.isEmpty()) builder.outputChances(newChances.toIntArray()); + if (heat != null) builder.metadata(COIL_HEAT, heat); + + builder.addTo(TecTechRecipeMaps.godforgeMoltenRecipes); + } + } + + private static FluidStack convertToMolten(ItemStack stack) { + // if this is null it has to be a gt++ material + ItemData data = GTOreDictUnificator.getAssociation(stack); + Materials mat = data == null ? null : data.mMaterial.mMaterial; + if (mat != null) { + if (mat.mStandardMoltenFluid != null) { + return mat.getMolten(INGOTS * data.mMaterial.mAmount / GTValues.M); + } else if (mat.mFluid != null) { + return mat.getFluid(BUCKETS); + } + } + int[] oreIDs = OreDictionary.getOreIDs(stack); + if (oreIDs.length == 0) { + return null; + } + String dict = OreDictionary.getOreName(oreIDs[0]); + + // Check various oredicts + String strippedOreDict = null; + if (dict.startsWith("ingotHot")) { + strippedOreDict = dict.substring(8); + } else if (dict.startsWith("dustRoasted") && !dict.contains("Cobalt")) { + strippedOreDict = dict.substring(11); + } + if (strippedOreDict != null) { + return FluidRegistry.getFluidStack("molten." + strippedOreDict.toLowerCase(), INGOTS); + } + return null; + } } diff --git a/src/main/java/tectech/recipe/GodforgePlasmaFrontend.java b/src/main/java/tectech/recipe/GodforgePlasmaFrontend.java index 5dfc46b1cfb..f5297702b51 100644 --- a/src/main/java/tectech/recipe/GodforgePlasmaFrontend.java +++ b/src/main/java/tectech/recipe/GodforgePlasmaFrontend.java @@ -1,5 +1,7 @@ package tectech.recipe; +import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_MULTISTEP; +import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_TIER; import static gregtech.api.util.GTUtility.trans; import static net.minecraft.util.StatCollector.translateToLocal; @@ -52,11 +54,10 @@ protected void drawEnergyInfo(RecipeDisplayInfo recipeInfo) { long eut = recipeInfo.recipe.mEUt; long duration = recipeInfo.recipe.mDuration; String multistep = "No"; - if (recipeInfo.recipe.mSpecialItems.toString() - .equals("true")) { + if (recipeInfo.recipe.getMetadataOrDefault(FOG_PLASMA_MULTISTEP, false)) { multistep = "Yes"; } - String requiredUpgrade = switch (recipeInfo.recipe.mSpecialValue) { + String requiredUpgrade = switch (recipeInfo.recipe.getMetadataOrDefault(FOG_PLASMA_TIER, 0)) { case 1 -> "T4-T5"; case 2 -> "Exotic"; default -> "T1-T3"; diff --git a/src/main/java/tectech/recipe/TecTechRecipeMaps.java b/src/main/java/tectech/recipe/TecTechRecipeMaps.java index b1c3608f459..d4908df5b7f 100644 --- a/src/main/java/tectech/recipe/TecTechRecipeMaps.java +++ b/src/main/java/tectech/recipe/TecTechRecipeMaps.java @@ -10,6 +10,7 @@ import gregtech.api.recipe.RecipeMapBackend; import gregtech.api.recipe.RecipeMapBuilder; import gregtech.api.util.GTRecipe; +import gregtech.nei.formatter.HeatingCoilSpecialValueFormatter; import tectech.thing.CustomItemList; import tectech.thing.gui.TecTechUITextures; @@ -74,5 +75,14 @@ public static void init() {} .neiTransferRect(78, 33, 20, 20) .frontend(GodforgeExoticFrontend::new) .build(); + public static final RecipeMap godforgeMoltenRecipes = RecipeMapBuilder.of("gt.recipe.fog_molten") + .maxIO(6, 6, 1, 2) + .minInputs(1, 0) + .progressBar(TecTechUITextures.PROGRESSBAR_GODFORGE_PLASMA, ProgressBar.Direction.RIGHT) + .neiSpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE) + .logo(TecTechUITextures.PICTURE_GODFORGE_LOGO) + .logoSize(18, 18) + .logoPos(151, 63) + .build(); } diff --git a/src/main/java/tectech/thing/block/RenderForgeOfGods.java b/src/main/java/tectech/thing/block/RenderForgeOfGods.java index 976dd6da8e5..04c46155c04 100644 --- a/src/main/java/tectech/thing/block/RenderForgeOfGods.java +++ b/src/main/java/tectech/thing/block/RenderForgeOfGods.java @@ -1,52 +1,427 @@ package tectech.thing.block; -import static tectech.Reference.MODID; -import static tectech.rendering.EOH.EOHRenderingUtils.renderStarLayer; import static tectech.rendering.EOH.EOHTileEntitySR.STAR_LAYER_0; import static tectech.rendering.EOH.EOHTileEntitySR.STAR_LAYER_1; import static tectech.rendering.EOH.EOHTileEntitySR.STAR_LAYER_2; +import static tectech.thing.casing.TTCasingsContainer.GodforgeCasings; -import java.awt.Color; +import java.nio.FloatBuffer; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; +import org.joml.Matrix4fStack; +import org.joml.Vector3f; +import org.joml.Vector4f; +import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL13; +import org.lwjgl.opengl.GL15; +import org.lwjgl.opengl.GL20; + +import com.gtnewhorizon.gtnhlib.client.renderer.shader.ShaderProgram; +import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VertexBuffer; + +import tectech.Reference; +import tectech.thing.metaTileEntity.multi.ForgeOfGodsRingsStructureString; +import tectech.thing.metaTileEntity.multi.ForgeOfGodsStructureString; +import tectech.util.StructureVBO; +import tectech.util.TextureUpdateRequester; public class RenderForgeOfGods extends TileEntitySpecialRenderer { - public static IModelCustom starModel; + private static ShaderProgram starProgram; + private static IModelCustom starModel; + private static float modelNormalize = .0067f * 2; + + private static boolean initialized = false; + private static int u_Color = -1, u_ModelMatrix = -1, u_Gamma = -1; + private Matrix4fStack starModelMatrix = new Matrix4fStack(3); + + private static ShaderProgram beamProgram; + private static int a_VertexID = -1; + private static int u_BeamModelMatrix = -1; + private static int u_CameraPosition = -1, u_SegmentArray = -1, u_SegmentQuads = -1; + private static int u_BeamIntensity = -1, u_BeamColor = -1, u_BeamTime = -1; + private static int beam_vboID = -1; + private static int maxSegments = -1; + private static final int beamSegmentQuads = 16; + private static Matrix4fStack beamModelMatrix = new Matrix4fStack(2); + + private VertexBuffer ringOne, ringTwo, ringThree; + // These are nudges/translations for each ring to align with the structure + private static final Vector3f ringOneNudge = new Vector3f(0, -1, 0); + private static final Vector3f ringTwoNudge = new Vector3f(0, -1, 0); + private static final Vector3f ringThreeNudge = new Vector3f(.5f, -1, 0); + + private static ShaderProgram fadeBypassProgram; + private static TextureUpdateRequester textureUpdater; + + private void init() { + try { + starProgram = new ShaderProgram(Reference.MODID, "shaders/star.vert.glsl", "shaders/star.frag.glsl"); + + u_Color = starProgram.getUniformLocation("u_Color"); + u_Gamma = starProgram.getUniformLocation("u_Gamma"); + u_ModelMatrix = starProgram.getUniformLocation("u_ModelMatrix"); + + } catch (Exception e) { + System.out.println(e.getMessage()); + return; + } + + starModel = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.MODID, "models/Star.obj")); + + try { + beamProgram = new ShaderProgram( + Reference.MODID, + "shaders/gorgeBeam.vert.glsl", + "shaders/gorgeBeam.frag.glsl"); - public RenderForgeOfGods() { - starModel = AdvancedModelLoader.loadModel(new ResourceLocation(MODID, "models/Star.obj")); + u_BeamModelMatrix = beamProgram.getUniformLocation("u_ModelMatrix"); + u_CameraPosition = beamProgram.getUniformLocation("u_CameraPosition"); + u_SegmentQuads = beamProgram.getUniformLocation("u_SegmentQuads"); + u_SegmentArray = beamProgram.getUniformLocation("u_SegmentArray"); + u_BeamColor = beamProgram.getUniformLocation("u_Color"); + u_BeamIntensity = beamProgram.getUniformLocation("u_Intensity"); + u_BeamTime = beamProgram.getUniformLocation("u_Time"); + + a_VertexID = beamProgram.getAttribLocation("a_VertexID"); + } catch (Exception e) { + System.out.println(e.getMessage()); + return; + } + + beamProgram.use(); + GL20.glUniform1f(u_SegmentQuads, (float) beamSegmentQuads); + maxSegments = 10;// GL20.glGetActiveUniformSize(beamProgram.getProgram(), u_SegmentArray); + + FloatBuffer buffer = BufferUtils.createFloatBuffer(maxSegments * beamSegmentQuads * 6 * 3); + + for (int i = 0; i < maxSegments; i++) { + for (int j = 0; j < beamSegmentQuads; j++) { + for (int v = 0; v < 6; v++) { + int segID = i * beamSegmentQuads * 6; + int quadID = j * 6; + int vertID = segID + quadID + v; + buffer.put(vertID); + buffer.put(0); + buffer.put(0); + } + } + } + + buffer.flip(); + beam_vboID = GL15.glGenBuffers(); + GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, beam_vboID); + GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW); + GL20.glVertexAttribPointer(a_VertexID, 1, GL11.GL_FLOAT, false, 3 * Float.BYTES, 0); + GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0); + + GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); + ShaderProgram.clear(); + initialized = true; } - @Override - public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) { - if (!(tile instanceof TileEntityForgeOfGods)) return; + private void initRings() { + StructureVBO ringStructure = (new StructureVBO()).addMapping('H', BlockGodforgeGlass.INSTANCE, 0) + .addMapping('B', GodforgeCasings, 0) + .addMapping('C', GodforgeCasings, 1) + .addMapping('D', GodforgeCasings, 2) + .addMapping('E', GodforgeCasings, 3) + .addMapping('G', GodforgeCasings, 5) + .addMapping('K', GodforgeCasings, 6) + .addMapping('I', GodforgeCasings, 7); - { - GL11.glPushMatrix(); - GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); - GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_BLEND); + ringOne = ringStructure.assignStructure(ForgeOfGodsStructureString.FIRST_RING) + .build(); + ringTwo = ringStructure.assignStructure(ForgeOfGodsRingsStructureString.SECOND_RING) + .build(); + ringThree = ringStructure.assignStructure(ForgeOfGodsRingsStructureString.THIRD_RING) + .build(); - // Innermost layer should be opaque - enableOpaqueColorInversion(); - renderStarLayer(0, STAR_LAYER_0, new Color(1.0f, 0.4f, 0.05f, 1.0f), 1.0f, 25); - disableOpaqueColorInversion(); + fadeBypassProgram = new ShaderProgram( + Reference.MODID, + "shaders/fadebypass.vert.glsl", + "shaders/fadebypass.frag.glsl"); - enablePseudoTransparentColorInversion(); - renderStarLayer(1, STAR_LAYER_1, new Color(1.0f, 0.4f, 0.05f, 1.0f), 0.4f, 25); - renderStarLayer(2, STAR_LAYER_2, new Color(1.0f, 0.4f, 0.05f, 1.0f), 0.2f, 25); + textureUpdater = ringStructure.getTextureUpdateRequestor(); + } + + public void RenderStarLayer(Vector4f color, ResourceLocation texture, float size, Vector3f rotationAxis, + float degrees) { + starModelMatrix.pushMatrix(); + starModelMatrix.rotate((degrees / 180f * ((float) Math.PI)), rotationAxis.x, rotationAxis.y, rotationAxis.z); + starModelMatrix.scale(size, size, size); + + this.bindTexture(texture); + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + + // Enable transparency if needed + if (color.w < 1 && color.w > 0) { + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); // Disable depth writing for transparency + } + + FloatBuffer matrixBuffer = BufferUtils.createFloatBuffer(16); + GL20.glUniformMatrix4(u_ModelMatrix, false, starModelMatrix.get(matrixBuffer)); + GL20.glUniform4f(u_Color, color.x, color.y, color.z, color.w); + starModel.renderAll(); + GL11.glPopAttrib(); + starModelMatrix.popMatrix(); + } + + public void RenderEntireStar(TileEntityForgeOfGods tile, double x, double y, double z, float timer) { + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + GL13.glActiveTexture(GL13.GL_TEXTURE0); + GL11.glDisable(GL11.GL_LIGHTING); + + starProgram.use(); + + float cx = (float) x + .5f; + float cy = (float) y + .5f; + float cz = (float) z + .5f; + float size = modelNormalize; + starModelMatrix.clear(); + starModelMatrix.translate(cx, cy, cz); + + size *= tile.getStarRadius(); - GL11.glPopAttrib(); + timer *= tile.getRotationSpeed(); + + float r = tile.getColorR(), g = tile.getColorG(), b = tile.getColorB(); + GL20.glUniform1f(u_Gamma, tile.getGamma()); + RenderStarLayer( + new Vector4f(r, g, b, 1f), + STAR_LAYER_0, + size, + new Vector3f(0F, 1F, 1).normalize(), + 130 + (timer) % 360000); + RenderStarLayer( + new Vector4f(r, g, b, 0.4f), + STAR_LAYER_1, + size * 1.02f, + new Vector3f(1F, 1F, 0F).normalize(), + -49 + (timer) % 360000); + RenderStarLayer( + new Vector4f(r, g, b, 0.2f), + STAR_LAYER_2, + size * 1.04f, + new Vector3f(1F, 0F, 1F).normalize(), + 67 + (timer) % 360000); + + ShaderProgram.clear(); + GL11.glPopAttrib(); + } + + public void bufferSoftBeam(TileEntityForgeOfGods tile) { + FloatBuffer buffer = BufferUtils.createFloatBuffer(maxSegments * 3); + + float angle = tile.getStartAngle(); + float radius = tile.getStarRadius() * 1.1f; + float startx = -radius * ((float) Math.cos(angle)); + float starty = radius * ((float) Math.sin(angle)); + + buffer.put(starty); + buffer.put(startx); + buffer.put(0); + + for (int i = tile.getRingCount() - 1; i >= 0; i--) { + buffer.put(tile.getLenRadius(i)); + buffer.put(tile.getLensDistance(i)); + buffer.put(1f); + } + + buffer.put(TileEntityForgeOfGods.BACK_PLATE_RADIUS); + buffer.put(TileEntityForgeOfGods.BACK_PLATE_DISTANCE); + buffer.put(-.05f); + + buffer.rewind(); + GL20.glUniform3(u_SegmentArray, buffer); + } + + public void bufferIntenseBeam(TileEntityForgeOfGods tile) { + FloatBuffer buffer = BufferUtils.createFloatBuffer(maxSegments * 3); + float angle = tile.getStartAngle(); + float radius = tile.getStarRadius() * 1.05f; + float startx = -radius * ((float) Math.cos(angle)); + float starty = radius * ((float) Math.sin(angle)); + + // first lens means the one closest to the star + int firstLens = tile.getRingCount() - 1; + + float nextx = tile.getLensDistance(firstLens); + float nexty = tile.getLenRadius(firstLens) * .75f; + + float backx = Math.max(-radius, (nextx + radius) / 2); + float backy = TileEntityForgeOfGods.interpolate(startx, nextx, starty, nexty, backx); + + buffer.put(backy); + buffer.put(backx); + buffer.put(0); + + float transparency = .2f; + for (int i = tile.getRingCount() - 1; i >= 0; i--) { + buffer.put(tile.getLenRadius(i) / 2); + buffer.put(tile.getLensDistance(i)); + buffer.put(transparency); + transparency += .3f; + } + + float currx = tile.getLensDistance(0); + float curry = tile.getLenRadius(0) / 2; + float lastx = TileEntityForgeOfGods.BACK_PLATE_DISTANCE; + float lasty = Math.min(tile.getLenRadius(firstLens), TileEntityForgeOfGods.BACK_PLATE_RADIUS); + + float midx = lastx + 8f; + float midy = TileEntityForgeOfGods.interpolate(currx, lastx, curry, lasty, midx); + + buffer.put(midy); + buffer.put(midx); + buffer.put(transparency); + + buffer.put(lasty); + buffer.put(lastx); + buffer.put(0f); + + buffer.rewind(); + GL20.glUniform3(u_SegmentArray, buffer); + // return buffer; + } + + public void RenderBeamSegment(TileEntityForgeOfGods tile, double x, double y, double z, float timer) { + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + // GL11.glDisable(GL11.GL_TEXTURE_2D); + // GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glDisable(GL11.GL_ALPHA_TEST); + GL11.glDisable(GL11.GL_LIGHTING); + GL13.glActiveTexture(GL13.GL_TEXTURE0); + this.bindTexture(new ResourceLocation(Reference.MODID, "models/spaceLayer.png")); + + float cx = (float) x + .5f; + float cy = (float) y + .5f; + float cz = (float) z + .5f; + beamModelMatrix.clear(); + beamModelMatrix.translate(cx, cy, cz); + + beamModelMatrix.rotate( + tile.getRotAngle() / 180 * ((float) Math.PI), + tile.getRotAxisX(), + tile.getRotAxisY(), + tile.getRotAxisZ()); + beamModelMatrix.rotate((float) Math.PI / 2f, 0, 1, 0); + + beamProgram.use(); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + GL11.glEnable(GL11.GL_DEPTH_TEST); + GL11.glDepthMask(false); // Disable depth writing for transparency + + bufferSoftBeam(tile); + + FloatBuffer matrixBuffer = BufferUtils.createFloatBuffer(16); + GL20.glUniformMatrix4(u_BeamModelMatrix, false, beamModelMatrix.get(matrixBuffer)); + + beamModelMatrix.invert(); + + Vector4f cameraPosition = new Vector4f( + ActiveRenderInfo.objectX, + ActiveRenderInfo.objectY, + ActiveRenderInfo.objectZ, + 1); + cameraPosition = beamModelMatrix.transform(cameraPosition); + GL20.glUniform3f(u_CameraPosition, cameraPosition.x, cameraPosition.y, cameraPosition.z); + GL20.glUniform3f(u_BeamColor, tile.getColorR(), tile.getColorG(), tile.getColorB()); + GL20.glUniform1f(u_BeamIntensity, 2); + GL20.glUniform1f(u_BeamTime, timer); + + GL20.glEnableVertexAttribArray(a_VertexID); + GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); + + GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, maxSegments * beamSegmentQuads * 6); + + GL20.glUniform3f(u_BeamColor, 1, 1, 1); + GL20.glUniform1f(u_BeamIntensity, 4); + bufferIntenseBeam(tile); + GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, maxSegments * beamSegmentQuads * 6); + + GL20.glDisableVertexAttribArray(a_VertexID); + GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); + + GL11.glPopAttrib(); + ShaderProgram.clear(); + } + + private void RenderRings(TileEntityForgeOfGods tile, double x, double y, double z, float timer) { + bindTexture(TextureMap.locationBlocksTexture); + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + textureUpdater.requestUpdate(); + fadeBypassProgram.use(); + + GL11.glPushMatrix(); + GL11.glTranslated(x + .5f, y + .5f, z + .5f); + GL11.glRotatef(tile.getRotAngle(), tile.getRotAxisX(), tile.getRotAxisY(), tile.getRotAxisZ()); + GL11.glRotatef(timer / 6 * 7, 1, 0, 0); + GL11.glTranslated(ringOneNudge.x, ringOneNudge.y, ringOneNudge.z); + + ringOne.render(); + GL11.glPopMatrix(); + if (tile.getRingCount() > 1) { + GL11.glPushMatrix(); + GL11.glTranslated(x + .5f, y + .5f, z + .5f); + GL11.glRotatef(tile.getRotAngle(), tile.getRotAxisX(), tile.getRotAxisY(), tile.getRotAxisZ()); + GL11.glRotatef(-timer / 4 * 5, 1, 0, 0); + GL11.glTranslated(ringTwoNudge.x, ringTwoNudge.y, ringTwoNudge.z); + ringTwo.render(); GL11.glPopMatrix(); + + if (tile.getRingCount() > 2) { + GL11.glPushMatrix(); + GL11.glTranslated(x + .5f, y + .5f, z + .5f); + GL11.glRotatef(tile.getRotAngle(), tile.getRotAxisX(), tile.getRotAxisY(), tile.getRotAxisZ()); + GL11.glRotatef(timer * 3, 1, 0, 0); + GL11.glTranslated(ringThreeNudge.x, ringThreeNudge.y, ringThreeNudge.z); + ringThree.render(); + GL11.glPopMatrix(); + } } + ShaderProgram.clear(); + GL11.glPopAttrib(); + } + + @Override + public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) { + if (!(tile instanceof TileEntityForgeOfGods forgeTile)) return; + if (forgeTile.getRingCount() < 1) return; + + if (!initialized) { + init(); + initRings(); + if (!initialized) return; + } + + // Based on system time to prevent tps issues from causing stutters + // Need to look into different timing system to prevent stutters based on tps issues + // But prevent bypassing the pause menu + long millis = System.currentTimeMillis() % (1000 * 36000); + float timer = millis / (50f); // to ticks + + RenderEntireStar(forgeTile, x, y, z, timer); + RenderRings(forgeTile, x, y, z, timer); + + RenderBeamSegment(forgeTile, x, y, z, timer); + } public static void enablePseudoTransparentColorInversion() { diff --git a/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java b/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java index 7c671b8a314..dfe4bab143a 100644 --- a/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java +++ b/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java @@ -6,11 +6,32 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraftforge.common.util.ForgeDirection; + +import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; public class TileEntityForgeOfGods extends TileEntity { - private float size = 10; + private float radius = 32; private float rotationSpeed = 10; + private int ringCount = 1; + private float colorR = .7f, colorG = .8f, colorB = 1f, gamma = 3f; + private float rotAngle = 0, rotAxisX = 1, rotAxisY = 0, rotAxisZ = 0; + + private static final String NBT_TAG = "FOG:"; + private static final String ROTATION_SPEED_NBT_TAG = NBT_TAG + "ROTATION"; + private static final String SIZE_NBT_TAG = NBT_TAG + "RADIUS"; + private static final String RINGS_NBT_TAG = NBT_TAG + "RINGS"; + private static final String COLOR_RED_NBT_TAG = NBT_TAG + "COLOR_RED"; + private static final String COLOR_GREEN_NBT_TAG = NBT_TAG + "COLOR_GREEN"; + private static final String COLOR_BLUE_NBT_TAG = NBT_TAG + "COLOR_BLUE"; + private static final String COLOR_GAMMA_NBT_TAG = NBT_TAG + "COLOR_GAMMA"; + private static final String ROT_ANGLE_NBT_TAG = NBT_TAG + "ROT_ANGLE"; + private static final String ROT_AXIS_X_NBT_TAG = NBT_TAG + "ROT_AXIS_X"; + private static final String ROT_AXIS_Y_NBT_TAG = NBT_TAG + "ROT_AXIS_Y"; + private static final String ROT_AXIS_Z_NBT_TAG = NBT_TAG + "ROT_AXIS_Z"; + + public static final float BACK_PLATE_DISTANCE = -121.5f, BACK_PLATE_RADIUS = 13f; @Override public AxisAlignedBB getRenderBoundingBox() { @@ -19,53 +40,156 @@ public AxisAlignedBB getRenderBoundingBox() { @Override public double getMaxRenderDistanceSquared() { - return 25600; + return 51200; } - public void setRenderSize(float size) { - this.size = size; + public void setStarRadius(float size) { + this.radius = size; } - public void setRenderRotationSpeed(float rotationSpeed) { - this.rotationSpeed = rotationSpeed; + public float getStarRadius() { + return radius; } - public float getRenderSize() { - return size; + public float getRotationSpeed() { + return rotationSpeed; } - public float getRenderRotationSpeed() { - return rotationSpeed; + public void setRotationSpeed(float speed) { + this.rotationSpeed = speed; } - @Override - public void updateEntity() { - angle += 10.0f; + public float getColorR() { + return colorR; + } + + public float getColorG() { + return colorG; + } + + public float getColorB() { + return colorB; + } + + public float getGamma() { + return gamma; + } + + public void setColor(float r, float g, float b) { + setColor(r, g, b, 1); + } + + public void setColor(float r, float g, float b, float gamma) { + colorR = r; + colorG = g; + colorB = b; + this.gamma = gamma; + } + + public int getRingCount() { + return ringCount; + } + + public void setRingCount(int count) { + if (ringCount < 1) return; + ringCount = count; + } + + public float getRotAngle() { + return rotAngle; + } + + public float getRotAxisX() { + return rotAxisX; + } + + public float getRotAxisY() { + return rotAxisY; } - // Used to track the rotation of the star - public float angle; + public float getRotAxisZ() { + return rotAxisZ; + } - private static final String FOG_NBT_TAG = "FOG:"; - private static final String ROTATION_SPEED_NBT_TAG = FOG_NBT_TAG + "renderRotationSpeed"; - private static final String SIZE_NBT_TAG = FOG_NBT_TAG + "renderSize"; + public void setRenderRotation(Rotation rotation, ForgeDirection direction) { + switch (direction) { + case SOUTH -> rotAngle = 90; + case NORTH -> rotAngle = 90; + case WEST -> rotAngle = 0; + case EAST -> rotAngle = 180; + case UP -> rotAngle = -90; + case DOWN -> rotAngle = -90; + } + rotAxisX = 0; + rotAxisY = direction.offsetZ + direction.offsetX; + rotAxisZ = direction.offsetY; + + updateToClient(); + } + + public float getLensDistance(int lensID) { + return switch (lensID) { + case 0 -> -61.5f; + case 1 -> -54.5f; + case 2 -> -44.5f; + default -> throw new IllegalStateException("Unexpected value: " + lensID); + }; + } + + public float getLenRadius(int lensID) { + return switch (lensID) { + case 0 -> 1.1f; + case 1 -> 3.5f; + case 2 -> 5f; + default -> throw new IllegalStateException("Unexpected value: " + lensID); + }; + } + + public float getStartAngle() { + float x = -getLensDistance(getRingCount() - 1); + float y = getLenRadius(getRingCount() - 1); + float alpha = (float) Math.atan2(y, x); + float beta = (float) Math.asin(radius / Math.sqrt(x * x + y * y)); + return alpha + ((float) Math.PI / 2 - beta); + } + + public static float interpolate(float x0, float x1, float y0, float y1, float x) { + return y0 + ((x - x0) * (y1 - y0)) / (x1 - x0); + } @Override public void writeToNBT(NBTTagCompound compound) { super.writeToNBT(compound); - - // Save stats compound.setFloat(ROTATION_SPEED_NBT_TAG, rotationSpeed); - compound.setFloat(SIZE_NBT_TAG, size); + compound.setFloat(SIZE_NBT_TAG, radius); + compound.setInteger(RINGS_NBT_TAG, ringCount); + compound.setFloat(COLOR_RED_NBT_TAG, colorR); + compound.setFloat(COLOR_GREEN_NBT_TAG, colorG); + compound.setFloat(COLOR_BLUE_NBT_TAG, colorB); + compound.setFloat(COLOR_GAMMA_NBT_TAG, gamma); + compound.setFloat(ROT_ANGLE_NBT_TAG, rotAngle); + compound.setFloat(ROT_AXIS_X_NBT_TAG, rotAxisX); + compound.setFloat(ROT_AXIS_Y_NBT_TAG, rotAxisY); + compound.setFloat(ROT_AXIS_Z_NBT_TAG, rotAxisZ); } @Override public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); - - // Load stats rotationSpeed = compound.getFloat(ROTATION_SPEED_NBT_TAG); - size = compound.getFloat(SIZE_NBT_TAG); + radius = compound.getFloat(SIZE_NBT_TAG); + + ringCount = compound.getInteger(RINGS_NBT_TAG); + if (ringCount < 1) ringCount = 1; + + colorR = compound.getFloat(COLOR_RED_NBT_TAG); + colorG = compound.getFloat(COLOR_GREEN_NBT_TAG); + colorB = compound.getFloat(COLOR_BLUE_NBT_TAG); + gamma = compound.getFloat(COLOR_GAMMA_NBT_TAG); + rotAngle = compound.getFloat(ROT_ANGLE_NBT_TAG); + rotAxisX = compound.getFloat(ROT_AXIS_X_NBT_TAG); + rotAxisY = compound.getFloat(ROT_AXIS_Y_NBT_TAG); + rotAxisZ = compound.getFloat(ROT_AXIS_Z_NBT_TAG); } @Override @@ -79,4 +203,8 @@ public Packet getDescriptionPacket() { public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { readFromNBT(pkt.func_148857_g()); } + + public void updateToClient() { + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } } diff --git a/src/main/java/tectech/thing/gui/TecTechUITextures.java b/src/main/java/tectech/thing/gui/TecTechUITextures.java index d4bc73f8e18..f2774dc42fa 100644 --- a/src/main/java/tectech/thing/gui/TecTechUITextures.java +++ b/src/main/java/tectech/thing/gui/TecTechUITextures.java @@ -23,6 +23,7 @@ public class TecTechUITextures { public static final UITexture BACKGROUND_GLOW_BLUE = UITexture.fullImage(MODID, "gui/background/blue_glow"); public static final UITexture BACKGROUND_GLOW_GREEN = UITexture.fullImage(MODID, "gui/background/green_glow"); public static final UITexture BACKGROUND_GLOW_WHITE = UITexture.fullImage(MODID, "gui/background/white_glow"); + public static final UITexture BACKGROUND_GLOW_RAINBOW = UITexture.fullImage(MODID, "gui/background/rainbow_glow"); public static final UITexture BACKGROUND_SPACE = UITexture.fullImage(MODID, "gui/background/space"); public static final UITexture BUTTON_STANDARD_16x16 = UITexture.fullImage(MODID, "gui/button/standard_16x16"); @@ -82,6 +83,7 @@ public class TecTechUITextures { public static final UITexture OVERLAY_BUTTON_BATTERY_OFF = UITexture .fullImage(MODID, "gui/overlay_button/battery_off"); public static final UITexture OVERLAY_BUTTON_FLAG = UITexture.fullImage(MODID, "gui/overlay_button/flag"); + public static final UITexture OVERLAY_BUTTON_HEART = UITexture.fullImage(MODID, "gui/overlay_button/heart"); public static final UITexture OVERLAY_CYCLIC_BLUE = UITexture.fullImage(MODID, "gui/overlay_button/cyclic_blue"); public static final UITexture OVERLAY_EJECTION_LOCKED = UITexture .fullImage(MODID, "gui/overlay_button/eject_disabled"); @@ -162,11 +164,26 @@ public class TecTechUITextures { public static final UITexture PICTURE_PARAMETER_GRAY = UITexture.fullImage(MODID, "gui/picture/parameter_gray"); public static final UITexture PICTURE_UNCERTAINTY_MONITOR_MULTIMACHINE = UITexture .fullImage(MODID, "gui/picture/uncertainty/monitor_multimachine"); - public static final UITexture PICTURE_UPGRADE_CONNECTOR_FULL = UITexture.fullImage(MODID, "gui/picture/connector"); - public static final UITexture PICTURE_UPGRADE_CONNECTOR_EMPTY = UITexture - .fullImage(MODID, "gui/picture/connector_empty"); - public static final UITexture PICTURE_UPGRADE_CONNECTOR_SWITCH = UITexture - .fullImage(MODID, "gui/picture/connector_switch"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_PURPLE = UITexture + .fullImage(MODID, "gui/picture/connector_purple"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_GREEN = UITexture + .fullImage(MODID, "gui/picture/connector_green"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_ORANGE = UITexture + .fullImage(MODID, "gui/picture/connector_orange"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_BLUE = UITexture + .fullImage(MODID, "gui/picture/connector_blue"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_RED = UITexture + .fullImage(MODID, "gui/picture/connector_red"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_PURPLE_OPAQUE = UITexture + .fullImage(MODID, "gui/picture/connector_purple_opaque"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_GREEN_OPAQUE = UITexture + .fullImage(MODID, "gui/picture/connector_green_opaque"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_ORANGE_OPAQUE = UITexture + .fullImage(MODID, "gui/picture/connector_orange_opaque"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_BLUE_OPAQUE = UITexture + .fullImage(MODID, "gui/picture/connector_blue_opaque"); + public static final UITexture PICTURE_UPGRADE_CONNECTOR_RED_OPAQUE = UITexture + .fullImage(MODID, "gui/picture/connector_red_opaque"); public static final UITexture SLOT_OUTLINE_GREEN = UITexture.fullImage(MODID, "gui/picture/green_selector"); public static final UITexture PICTURE_GODFORGE_MILESTONE_CHARGE = UITexture .fullImage(MODID, "gui/picture/milestone_charge"); @@ -176,6 +193,7 @@ public class TecTechUITextures { .fullImage(MODID, "gui/picture/milestone_catalyst"); public static final UITexture PICTURE_GODFORGE_MILESTONE_COMPOSITION = UITexture .fullImage(MODID, "gui/picture/milestone_composition"); + public static final UITexture PICTURE_GODFORGE_THANKS = UITexture.fullImage(MODID, "gui/picture/thanks"); public static final UITexture PICTURE_GODFORGE_MILESTONE_CHARGE_GLOW = UITexture .fullImage(MODID, "gui/picture/milestone_charge_glow"); public static final UITexture PICTURE_GODFORGE_MILESTONE_CONVERSION_GLOW = UITexture diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/MTEForgeOfGods.java b/src/main/java/tectech/thing/metaTileEntity/multi/MTEForgeOfGods.java index 181ee0d6d4d..d55bf32e902 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/MTEForgeOfGods.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/MTEForgeOfGods.java @@ -38,6 +38,7 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -50,9 +51,9 @@ import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.IDrawable; -import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; import com.gtnewhorizons.modularui.api.drawable.Text; import com.gtnewhorizons.modularui.api.drawable.UITexture; +import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; import com.gtnewhorizons.modularui.api.math.Alignment; import com.gtnewhorizons.modularui.api.math.Color; @@ -66,12 +67,14 @@ import com.gtnewhorizons.modularui.common.widget.ButtonWidget; import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn; +import com.gtnewhorizons.modularui.common.widget.DynamicPositionedRow; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.FluidNameHolderWidget; import com.gtnewhorizons.modularui.common.widget.MultiChildWidget; import com.gtnewhorizons.modularui.common.widget.ProgressBar; import com.gtnewhorizons.modularui.common.widget.Scrollable; import com.gtnewhorizons.modularui.common.widget.SlotGroup; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; import com.gtnewhorizons.modularui.common.widget.textfield.NumericWidget; @@ -97,6 +100,7 @@ import gregtech.common.tileentities.machines.MTEHatchInputME; import gregtech.common.tileentities.machines.MTEHatchOutputBusME; import tectech.TecTech; +import tectech.loader.TecTechConfig; import tectech.thing.block.BlockGodforgeGlass; import tectech.thing.block.TileEntityForgeOfGods; import tectech.thing.gui.TecTechUITextures; @@ -150,6 +154,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, private static final int INDIVIDUAL_MILESTONE_WINDOW_ID = 14; private static final int MANUAL_INSERTION_WINDOW_ID = 15; private static final int GENERAL_INFO_WINDOW_ID = 16; + private static final int SPECIAL_THANKS_WINDOW_ID = 17; private static final int TEXTURE_INDEX = 960; private static final int[] FIRST_SPLIT_UPGRADES = new int[] { 12, 13, 14 }; private static final Integer[] UPGRADE_MATERIAL_ID_CONVERSION = { 0, 5, 7, 11, 26, 29, 30 }; @@ -178,10 +183,9 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, private static final ItemStack STELLAR_FUEL = Avaritia.isModLoaded() ? getModItem(Avaritia.ID, "Resource", 1, 8) : GTOreDictUnificator.get(OrePrefixes.block, Materials.CosmicNeutronium, 1); - private final boolean debugMode = false; + private final boolean debugMode = TecTechConfig.DEBUG_MODE; public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { - if (mMachine) return -1; int realBudget = elementBudget >= 1000 ? elementBudget : Math.min(1000, elementBudget * 5); // 1000 blocks max per placement. int built = survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 63, 14, 1, realBudget, env, false, true); @@ -241,7 +245,7 @@ public IStructureDefinition getStructure_EM() { HatchElementBuilder.builder() .atLeast(moduleElement.Module) .casingIndex(TEXTURE_INDEX) - .dot(3) + .dot(2) .buildAndChain(GodforgeCasings, 0)) .addElement('K', ofBlock(GodforgeCasings, 6)) .addElement('L', ofBlock(Blocks.air, 0)) @@ -309,7 +313,6 @@ public void construct(ItemStack stackSize, boolean hintsOnly) { public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { moduleHatches.clear(); - // Check structure of multi if (isRenderActive) { if (!structureCheck_EM(STRUCTURE_PIECE_SHAFT, 63, 14, 1) @@ -324,7 +327,6 @@ public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStac if (internalBattery != 0 && !isRenderActive) { createRenderer(); } - // Check there is 1 input bus if (mInputBusses.size() != 1) { return false; @@ -340,7 +342,6 @@ public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStac return false; } } - // Make sure there are no energy hatches { if (mEnergyHatches.size() > 0) { @@ -360,19 +361,38 @@ public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStac if (isUpgradeActive(26)) { if (checkPiece(STRUCTURE_PIECE_SECOND_RING, 55, 11, -67)) { ringAmount = 2; + destroySecondRing(); + UpdateRenderer(); } if (isRenderActive && ringAmount >= 2 && !checkPiece(STRUCTURE_PIECE_SECOND_RING_AIR, 55, 11, -67)) { destroyRenderer(); } + } else { + if (ringAmount == 3) { + buildThirdRing(); + } + if (ringAmount >= 2) { + ringAmount = 1; + UpdateRenderer(); + buildSecondRing(); + } } if (isUpgradeActive(29)) { if (checkPiece(STRUCTURE_PIECE_THIRD_RING, 47, 13, -76)) { ringAmount = 3; + destroyThirdRing(); + UpdateRenderer(); } if (isRenderActive && ringAmount == 3 && !checkPiece(STRUCTURE_PIECE_THIRD_RING_AIR, 47, 13, -76)) { destroyRenderer(); } + } else { + if (ringAmount == 3) { + ringAmount = 2; + UpdateRenderer(); + buildThirdRing(); + } } return true; @@ -548,6 +568,38 @@ public IGTHatchAdder adder() { } } + private TileEntityForgeOfGods getRenderer() { + IGregTechTileEntity gregTechTileEntity = this.getBaseMetaTileEntity(); + + int x = gregTechTileEntity.getXCoord(); + int y = gregTechTileEntity.getYCoord(); + int z = gregTechTileEntity.getZCoord(); + + double xOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetX; + double zOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetZ; + double yOffset = 122 * getExtendedFacing().getRelativeBackInWorld().offsetY; + + TileEntity tile = this.getBaseMetaTileEntity() + .getWorld() + .getTileEntity((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset)); + + if (tile instanceof TileEntityForgeOfGods forgeTile) { + return forgeTile; + } + return null; + } + + private void UpdateRenderer() { + TileEntityForgeOfGods tile = getRenderer(); + if (tile == null) return; + + tile.setRingCount(ringAmount); + tile.setStarRadius(20); + tile.setRotationSpeed(5); + + tile.updateToClient(); + } + private void createRenderer() { IGregTechTileEntity gregTechTileEntity = this.getBaseMetaTileEntity(); @@ -570,24 +622,24 @@ private void createRenderer() { .getWorld() .getTileEntity((int) (x + xOffset), (int) (y + yOffset), (int) (z + zOffset)); - rendererTileEntity.setRenderSize(20); - rendererTileEntity.setRenderRotationSpeed(5); - switch (ringAmount) { case 2 -> { - buildPiece(STRUCTURE_PIECE_FIRST_RING_AIR, null, false, 63, 14, -59); - buildPiece(STRUCTURE_PIECE_SECOND_RING_AIR, null, false, 55, 11, -67); + destroyFirstRing(); + destroySecondRing(); } case 3 -> { - buildPiece(STRUCTURE_PIECE_FIRST_RING_AIR, null, false, 63, 14, -59); - buildPiece(STRUCTURE_PIECE_SECOND_RING_AIR, null, false, 55, 11, -67); - buildPiece(STRUCTURE_PIECE_THIRD_RING_AIR, null, false, 47, 13, -76); + destroyFirstRing(); + destroySecondRing(); + destroyThirdRing(); } default -> { - buildPiece(STRUCTURE_PIECE_FIRST_RING_AIR, null, false, 63, 14, -59); + destroyFirstRing(); } } + rendererTileEntity.setRenderRotation(getRotation(), getDirection()); + UpdateRenderer(); + isRenderActive = true; } @@ -609,26 +661,65 @@ private void destroyRenderer() { switch (ringAmount) { case 2 -> { - buildPiece(STRUCTURE_PIECE_FIRST_RING, null, false, 63, 14, -59); - buildPiece(STRUCTURE_PIECE_SECOND_RING, null, false, 55, 11, -67); + buildFirstRing(); + buildSecondRing(); } case 3 -> { - buildPiece(STRUCTURE_PIECE_FIRST_RING, null, false, 63, 14, -59); - buildPiece(STRUCTURE_PIECE_SECOND_RING, null, false, 55, 11, -67); - buildPiece(STRUCTURE_PIECE_THIRD_RING, null, false, 47, 13, -76); + buildFirstRing(); + buildSecondRing(); + buildThirdRing(); } default -> { - buildPiece(STRUCTURE_PIECE_FIRST_RING, null, false, 63, 14, -59); + buildFirstRing(); } } isRenderActive = false; } + private void destroyFirstRing() { + buildPiece(STRUCTURE_PIECE_FIRST_RING_AIR, null, false, 63, 14, -59); + } + + private void destroySecondRing() { + buildPiece(STRUCTURE_PIECE_SECOND_RING_AIR, null, false, 55, 11, -67); + } + + private void destroyThirdRing() { + buildPiece(STRUCTURE_PIECE_THIRD_RING_AIR, null, false, 47, 13, -76); + } + + private void buildFirstRing() { + buildPiece(STRUCTURE_PIECE_FIRST_RING, null, false, 63, 14, -59); + } + + private void buildSecondRing() { + buildPiece(STRUCTURE_PIECE_SECOND_RING, null, false, 55, 11, -67); + } + + private void buildThirdRing() { + buildPiece(STRUCTURE_PIECE_THIRD_RING, null, false, 47, 13, -76); + } + + @Override + public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (!debugMode) return; + if (isRenderActive) { + destroyRenderer(); + isRenderActive = false; + } else { + ringAmount = 3; + createRenderer(); + isRenderActive = true; + } + } + @Override public void onBlockDestroyed() { super.onBlockDestroyed(); - destroyRenderer(); + if (isRenderActive) { + destroyRenderer(); + } } @Override @@ -673,6 +764,7 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont buildContext.addSyncedWindow(INDIVIDUAL_MILESTONE_WINDOW_ID, this::createIndividualMilestoneWindow); buildContext.addSyncedWindow(MANUAL_INSERTION_WINDOW_ID, this::createManualInsertionWindow); buildContext.addSyncedWindow(GENERAL_INFO_WINDOW_ID, this::createGeneralInfoWindow); + buildContext.addSyncedWindow(SPECIAL_THANKS_WINDOW_ID, this::createSpecialThanksWindow); builder.widget( new ButtonWidget().setOnClick( (clickData, widget) -> { @@ -765,6 +857,17 @@ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildCont .setSize(18, 18) .addTooltip(translateToLocal("gt.blockmachines.multimachine.FOG.clickhere")) .setPos(172, 67) + .setTooltipShowUpDelay(TOOLTIP_DELAY)) + .widget( + new ButtonWidget().setOnClick( + (clickData, widget) -> { + if (!widget.isClient()) widget.getContext() + .openSyncedWindow(SPECIAL_THANKS_WINDOW_ID); + }) + .setSize(16, 16) + .addTooltip(translateToLocal("fog.button.thanks.tooltip")) + .setBackground(TecTechUITextures.OVERLAY_BUTTON_HEART) + .setPos(8, 69) .setTooltipShowUpDelay(TOOLTIP_DELAY)); } @@ -1277,6 +1380,11 @@ private Widget createMilestoneButton(int milestoneID, int width, int height, Pos return new ButtonWidget().setOnClick((clickData, widget) -> { currentMilestoneID = milestoneID; if (!widget.isClient()) { + if (widget.getContext() + .isWindowOpen(INDIVIDUAL_MILESTONE_WINDOW_ID)) { + widget.getContext() + .closeWindow(INDIVIDUAL_MILESTONE_WINDOW_ID); + } widget.getContext() .openSyncedWindow(INDIVIDUAL_MILESTONE_WINDOW_ID); } @@ -1297,11 +1405,11 @@ private Widget createMilestoneButton(int milestoneID, int width, int height, Pos private int currentColorCode = 0; private int currentMilestoneBG = 0; private int gravitonShardCost = 0; - private int[] prereqUpgrades = new int[] {}; + private int[][] prereqUpgrades = new int[31][]; private int[] followupUpgrades = new int[] {}; - private boolean allPrereqRequired = false; private boolean isUpradeSplitStart = false; private boolean doesCurrentUpgradeRequireExtraMats = false; + private boolean[] allPrereqRequired = new boolean[31]; private boolean[] upgrades = new boolean[31]; private boolean[] materialPaidUpgrades = new boolean[7]; @@ -1310,6 +1418,44 @@ protected ModularWindow createUpgradeTreeWindow(final EntityPlayer player) { final int PARENT_WIDTH = 300; final int PARENT_HEIGHT = 300; ModularWindow.Builder builder = ModularWindow.builder(PARENT_WIDTH, PARENT_HEIGHT); + + scrollable.widget(createUpgradeConnectorLine(new Pos2d(143, 71), 45, 0, 0, 0, 1)) + .widget(createUpgradeConnectorLine(new Pos2d(124, 124), 60, 27, 0, 1, 2)) + .widget(createUpgradeConnectorLine(new Pos2d(162, 124), 60, 333, 0, 1, 3)) + .widget(createUpgradeConnectorLine(new Pos2d(94, 184), 60, 27, 0, 2, 4)) + .widget(createUpgradeConnectorLine(new Pos2d(130, 184), 60, 336, 0, 2, 5)) + .widget(createUpgradeConnectorLine(new Pos2d(156, 184), 60, 24, 0, 3, 5)) + .widget(createUpgradeConnectorLine(new Pos2d(192, 184), 60, 333, 0, 3, 6)) + .widget(createUpgradeConnectorLine(new Pos2d(143, 251), 45, 0, 0, 5, 7)) + .widget(createUpgradeConnectorLine(new Pos2d(143, 311), 45, 0, 0, 7, 9)) + .widget(createUpgradeConnectorLine(new Pos2d(78, 250), 110, 5, 4, 4, 8)) + .widget(createUpgradeConnectorLine(new Pos2d(110, 290), 80, 40, 4, 7, 8)) + .widget(createUpgradeConnectorLine(new Pos2d(208, 250), 110, 355, 4, 6, 10)) + .widget(createUpgradeConnectorLine(new Pos2d(176, 290), 80, 320, 4, 7, 10)) + .widget(createUpgradeConnectorLine(new Pos2d(100, 355), 80, 313, 0, 8, 11)) + .widget(createUpgradeConnectorLine(new Pos2d(186, 355), 80, 47, 0, 10, 11)) + .widget(createUpgradeConnectorLine(new Pos2d(143, 430), 48, 0, 2, 11, 13)) + .widget(createUpgradeConnectorLine(new Pos2d(143, 490), 48, 0, 2, 13, 18)) + .widget(createUpgradeConnectorLine(new Pos2d(143, 550), 48, 0, 2, 18, 21)) + .widget(createUpgradeConnectorLine(new Pos2d(143, 610), 48, 0, 2, 21, 23)) + .widget(createUpgradeConnectorLine(new Pos2d(110, 410), 80, 40, 1, 11, 12)) + .widget(createUpgradeConnectorLine(new Pos2d(83, 490), 48, 0, 1, 12, 17)) + .widget(createUpgradeConnectorLine(new Pos2d(83, 550), 48, 0, 1, 17, 20)) + .widget(createUpgradeConnectorLine(new Pos2d(101, 590), 80, 320, 1, 20, 23)) + .widget(createUpgradeConnectorLine(new Pos2d(53, 536), 35, 45, 1, 17, 16)) + .widget(createUpgradeConnectorLine(new Pos2d(176, 410), 80, 320, 3, 11, 14)) + .widget(createUpgradeConnectorLine(new Pos2d(203, 490), 48, 0, 3, 14, 19)) + .widget(createUpgradeConnectorLine(new Pos2d(203, 550), 48, 0, 3, 19, 22)) + .widget(createUpgradeConnectorLine(new Pos2d(185, 590), 80, 40, 3, 22, 23)) + .widget(createUpgradeConnectorLine(new Pos2d(233, 476), 35, 315, 3, 14, 15)) + .widget(createUpgradeConnectorLine(new Pos2d(143, 670), 48, 0, 0, 23, 24)) + .widget(createUpgradeConnectorLine(new Pos2d(101, 707), 75, 62.3f, 0, 24, 25)) + .widget(createUpgradeConnectorLine(new Pos2d(53, 772), 78, 0, 0, 25, 26)) + .widget(createUpgradeConnectorLine(new Pos2d(95, 837), 75, 297.7f, 0, 26, 27)) + .widget(createUpgradeConnectorLine(new Pos2d(191, 837), 75, 62.3f, 0, 27, 28)) + .widget(createUpgradeConnectorLine(new Pos2d(233, 772), 78, 0, 0, 28, 29)) + .widget(createUpgradeConnectorLine(new Pos2d(191, 747), 75, 62.3f, 0, 29, 30)); + scrollable .widget( createUpgradeBox( @@ -1725,6 +1871,14 @@ protected ModularWindow createUpgradeTreeWindow(final EntityPlayer player) { .setPos(4, 4)) .widget( ButtonWidget.closeWindowButton(true) + .setOnClick((data, widget) -> { + if (!widget.isClient()) { + widget.getWindow() + .closeWindow(); + widget.getContext() + .closeWindow(INDIVIDUAL_UPGRADE_WINDOW_ID); + } + }) .setPos(282, 4)); if (debugMode) { builder.widget(new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> { @@ -1881,10 +2035,9 @@ protected ModularWindow createIndividualUpgradeWindow(final EntityPlayer player) .widget(new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> { int unlockedPrereqUpgrades = 0; - int unlockedFollowupUpgrades = 0; int unlockedSplitUpgrades = 0; if (!upgrades[currentUpgradeID]) { - for (int prereqUpgrade : prereqUpgrades) { + for (int prereqUpgrade : prereqUpgrades[currentUpgradeID]) { if (upgrades[prereqUpgrade]) { unlockedPrereqUpgrades++; } @@ -1892,14 +2045,14 @@ protected ModularWindow createIndividualUpgradeWindow(final EntityPlayer player) if (!doesCurrentUpgradeRequireExtraMats || materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION) .indexOf(currentUpgradeID)]) { - if (allPrereqRequired) { - if (unlockedPrereqUpgrades == prereqUpgrades.length + if (allPrereqRequired[currentUpgradeID]) { + if (unlockedPrereqUpgrades == prereqUpgrades[currentUpgradeID].length && gravitonShardsAvailable >= gravitonShardCost) { gravitonShardsAvailable -= gravitonShardCost; gravitonShardsSpent += gravitonShardCost; upgrades[currentUpgradeID] = true; } - } else if (unlockedPrereqUpgrades > 0 || prereqUpgrades.length == 0) { + } else if (unlockedPrereqUpgrades > 0 || prereqUpgrades[currentUpgradeID].length == 0) { if (isUpradeSplitStart) { for (int splitUpgrade : FIRST_SPLIT_UPGRADES) { if (upgrades[splitUpgrade]) { @@ -1916,11 +2069,34 @@ protected ModularWindow createIndividualUpgradeWindow(final EntityPlayer player) } } } else { + int unlockedFollowupUpgrades = 0; + int unlockedNeighboringUpgrades = 0; + boolean doesFollowupRequireAllPrereqs = false; + boolean canFollowupSpareAConnection = true; + for (int followupUpgrade : followupUpgrades) { if (upgrades[followupUpgrade]) { unlockedFollowupUpgrades++; } + if (allPrereqRequired[followupUpgrade]) { + doesFollowupRequireAllPrereqs = true; + } + int[] currentPrereqs = prereqUpgrades[followupUpgrade]; + for (int prereqUpgrade : currentPrereqs) { + if (upgrades[prereqUpgrade]) { + unlockedNeighboringUpgrades++; + } + } + if (unlockedNeighboringUpgrades <= 1) { + canFollowupSpareAConnection = false; + } + unlockedNeighboringUpgrades = 0; } + + if (!doesFollowupRequireAllPrereqs && followupUpgrades.length > 0 && canFollowupSpareAConnection) { + unlockedFollowupUpgrades = 0; + } + if (unlockedFollowupUpgrades == 0) { gravitonShardsAvailable += gravitonShardCost; gravitonShardsSpent -= gravitonShardCost; @@ -1936,10 +2112,11 @@ protected ModularWindow createIndividualUpgradeWindow(final EntityPlayer player) return new IDrawable[] { GTUITextures.BUTTON_STANDARD }; } }) - .addTooltip(translateToLocal("fog.upgrade.confirm")) + .dynamicTooltip(this::constructionStatus) .setTooltipShowUpDelay(TOOLTIP_DELAY)) .addChild( - new TextWidget(translateToLocal("fog.upgrade.confirm")).setTextAlignment(Alignment.Center) + TextWidget.dynamicText(this::constructionStatusText) + .setTextAlignment(Alignment.Center) .setScale(0.7f) .setMaxWidth(36) .setPos(3, 5)) @@ -2006,18 +2183,27 @@ private Widget createMaterialInputButton(int upgradeID, int xCoord, int yCoord, private Widget createUpgradeBox(int upgradeID, int colorCode, int milestone, int[] prerequisiteUpgradeIDs, boolean requireAllPrerequisites, int[] followingUpgradeIDs, boolean isStartOfSplit, boolean requiresExtraMaterials, int shardCost, Pos2d pos, IWidgetBuilder builder) { + prereqUpgrades[upgradeID] = prerequisiteUpgradeIDs; + allPrereqRequired[upgradeID] = requireAllPrerequisites; return new MultiChildWidget().addChild(new ButtonWidget().setOnClick((clickData, widget) -> { currentUpgradeID = upgradeID; currentColorCode = colorCode; currentMilestoneBG = milestone; gravitonShardCost = shardCost; - prereqUpgrades = prerequisiteUpgradeIDs; - allPrereqRequired = requireAllPrerequisites; followupUpgrades = followingUpgradeIDs; isUpradeSplitStart = isStartOfSplit; doesCurrentUpgradeRequireExtraMats = requiresExtraMaterials; - if (!widget.isClient()) widget.getContext() - .openSyncedWindow(INDIVIDUAL_UPGRADE_WINDOW_ID); + if (!widget.isClient()) { + // unfortunately this is the easiest way to prevent this window desyncing. it causes the window to + // reposition itself on the screen which would be a good thing to not do. + if (widget.getContext() + .isWindowOpen(INDIVIDUAL_UPGRADE_WINDOW_ID)) { + widget.getContext() + .closeWindow(INDIVIDUAL_UPGRADE_WINDOW_ID); + } + widget.getContext() + .openSyncedWindow(INDIVIDUAL_UPGRADE_WINDOW_ID); + } }) .setSize(40, 15) .setBackground(() -> { @@ -2041,6 +2227,44 @@ private Widget createUpgradeBox(int upgradeID, int colorCode, int milestone, int builder); } + private Widget createUpgradeConnectorLine(Pos2d pos, int length, float rotationAngle, int colorCode, + int startUpgradeID, int endUpgradeID) { + return new DrawableWidget() + .setDrawable( + () -> (upgrades[startUpgradeID] && upgrades[endUpgradeID]) + ? coloredLine(colorCode, true).withRotationDegree(rotationAngle) + : coloredLine(colorCode, false).withRotationDegree(rotationAngle)) + .setPos(pos) + .setSize(6, length); + } + + private IDrawable coloredLine(int colorCode, boolean opaque) { + IDrawable line; + switch (colorCode) { + case 1 -> { + line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_PURPLE_OPAQUE + : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_PURPLE; + } + case 2 -> { + line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_ORANGE_OPAQUE + : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_ORANGE; + } + case 3 -> { + line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_GREEN_OPAQUE + : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_GREEN; + } + case 4 -> { + line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_RED_OPAQUE + : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_RED; + } + default -> { + line = opaque ? TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_BLUE_OPAQUE + : TecTechUITextures.PICTURE_UPGRADE_CONNECTOR_BLUE; + } + } + return line; + } + protected ModularWindow createManualInsertionWindow(final EntityPlayer player) { ItemStack[] inputs = godforgeUpgradeMats.get(currentUpgradeID); final int WIDTH = 189; @@ -2121,25 +2345,26 @@ protected ModularWindow createManualInsertionWindow(final EntityPlayer player) { .setPos(5, 82) .setSize(179, 16)); + IItemHandlerModifiable upgradeMatsHandler = new ItemStackHandler(12); int uniqueItems = inputs.length; for (int i = 0; i < 12; i++) { int index = i; int cleanDiv4 = index / 4; if (i < uniqueItems) { + ItemStack stack = inputs[index]; + if (stack != null) { + stack = stack.copy(); + stack.stackSize = 1; + upgradeMatsHandler.setStackInSlot(index, stack); + } builder.widget( new DrawableWidget().setDrawable(GTUITextures.BUTTON_STANDARD_PRESSED) .setPos(5 + cleanDiv4 * 36, 6 + index % 4 * 18) .setSize(18, 18)); columnList.get(cleanDiv4) .addChild( - new ItemDrawable().setItem(inputs[index]) - .asWidget() - .dynamicTooltip(() -> { - List tooltip = new ArrayList<>(); - tooltip.add(inputs[index] != null ? inputs[index].getDisplayName() : ""); - return tooltip; - }) - .setSize(16, 16)); + new SlotWidget(upgradeMatsHandler, index).setAccess(false, false) + .disableInteraction()); columnList.get(cleanDiv4 + 3) .addChild( new TextWidget("x" + inputs[i].stackSize).setTextAlignment(Alignment.CenterLeft) @@ -2155,9 +2380,9 @@ protected ModularWindow createManualInsertionWindow(final EntityPlayer player) { int counter = 0; for (DynamicPositionedColumn column : columnList) { - int spacing = 2; - int xCord = 1 + counter * 36; - int yCord = 1; + int spacing = 0; + int xCord = counter * 36; + int yCord = 0; if (counter > 2) { spacing = 10; xCord = 19 + (counter - 3) * 36; @@ -2336,6 +2561,137 @@ protected ModularWindow createGeneralInfoWindow(final EntityPlayer player) { return builder.build(); } + protected ModularWindow createSpecialThanksWindow(final EntityPlayer player) { + final int WIDTH = 200; + final int HEIGHT = 200; + ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT); + + builder.setBackground(TecTechUITextures.BACKGROUND_GLOW_RAINBOW); + builder.setDraggable(true); + builder.widget( + ButtonWidget.closeWindowButton(true) + .setPos(184, 4)) + .widget( + new DrawableWidget().setDrawable(TecTechUITextures.PICTURE_GODFORGE_THANKS) + .setPos(50, 50) + .setSize(100, 100)) + .widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.contributors")) + .setDefaultColor(EnumChatFormatting.GOLD) + .setTextAlignment(Alignment.Center) + .setScale(1f) + .setPos(0, 5) + .setSize(200, 15)) + .widget( + new TextWidget( + EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.lead")) + .setScale(0.8f) + .setDefaultColor(EnumChatFormatting.GOLD) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 30) + .setSize(60, 10)) + .widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.cloud")).setScale(0.8f) + .setDefaultColor(EnumChatFormatting.AQUA) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 40) + .setSize(60, 10)) + .widget( + new TextWidget( + EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.programming")) + .setScale(0.8f) + .setDefaultColor(EnumChatFormatting.GOLD) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 55) + .setSize(60, 10)) + .widget( + new TextWidget( + EnumChatFormatting.DARK_AQUA + translateToLocal("gt.blockmachines.multimachine.FOG.teg") + + " " + + EnumChatFormatting.RESET + + translateToLocal("gt.blockmachines.multimachine.FOG.serenybiss")).setScale(0.8f) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 67) + .setSize(60, 10)) + .widget( + new TextWidget( + EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.textures")) + .setScale(0.8f) + .setDefaultColor(EnumChatFormatting.GOLD) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 85) + .setSize(100, 10)) + .widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.ant")).setScale(0.8f) + .setDefaultColor(EnumChatFormatting.GREEN) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 95) + .setSize(60, 10)) + .widget( + new TextWidget( + EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.rendering")) + .setScale(0.8f) + .setDefaultColor(EnumChatFormatting.GOLD) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 110) + .setSize(100, 10)) + .widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.bucket")).setScale(0.8f) + .setDefaultColor(EnumChatFormatting.WHITE) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 120) + .setSize(60, 10)) + .widget( + new TextWidget( + EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.lore")) + .setScale(0.8f) + .setDefaultColor(EnumChatFormatting.GOLD) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 135) + .setSize(100, 10)) + .widget( + delenoName().setSpace(-1) + .setAlignment(MainAxisAlignment.SPACE_BETWEEN) + .setPos(7, 145) + .setSize(60, 10)) + .widget( + new TextWidget( + EnumChatFormatting.UNDERLINE + translateToLocal("gt.blockmachines.multimachine.FOG.playtesting")) + .setScale(0.8f) + .setDefaultColor(EnumChatFormatting.GOLD) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 160) + .setSize(100, 10)) + .widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.misi")).setScale(0.8f) + .setDefaultColor(0xffc26f) + .setTextAlignment(Alignment.CenterLeft) + .setPos(7, 170) + .setSize(60, 10)) + .widget( + new TextWidget(EnumChatFormatting.ITALIC + translateToLocal("gt.blockmachines.multimachine.FOG.thanks")) + .setScale(0.8f) + .setDefaultColor(0xbbbdbd) + .setTextAlignment(Alignment.Center) + .setPos(90, 140) + .setSize(100, 60)); + return builder.build(); + } + + private DynamicPositionedRow delenoName() { + DynamicPositionedRow nameRow = new DynamicPositionedRow(); + String deleno = translateToLocal("gt.blockmachines.multimachine.FOG.deleno"); + int[] colors = new int[] { 0xffffff, 0xf6fff5, 0xecffec, 0xe3ffe2, 0xd9ffd9, 0xd0ffcf }; + + for (int i = 0; i < 6; i++) { + nameRow.addChild( + new TextWidget(Character.toString(deleno.charAt(i))).setDefaultColor(colors[i]) + .setScale(0.8f) + .setTextAlignment(Alignment.CenterLeft)); + } + return nameRow; + } + @Override public MultiblockTooltipBuilder createTooltip() { final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); @@ -2475,7 +2831,7 @@ public MultiblockTooltipBuilder createTooltip() { EnumChatFormatting.GOLD + "36" + EnumChatFormatting.GRAY + " Stellar Energy Siphon Casing") .addStructureInfo("--------------------------------------------") .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Input Hatch") - .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Output Bus") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Output Bus (ME)") .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Input Bus") .addStructureInfo("--------------------------------------------") .toolTipFinisher(CommonValues.GODFORGE_MARK); @@ -2888,6 +3244,18 @@ private Text inversionInfoText() { : new Text(""); } + private Text constructionStatusText() { + return upgrades[currentUpgradeID] ? new Text(translateToLocal("fog.upgrade.respec")) + : new Text(translateToLocal("fog.upgrade.confirm")); + } + + private List constructionStatus() { + if (upgrades[currentUpgradeID]) { + return ImmutableList.of(translateToLocal("fog.upgrade.respec")); + } + return ImmutableList.of(translateToLocal("fog.upgrade.confirm")); + } + private List upgradeMaterialRequirements() { if (materialPaidUpgrades[Arrays.asList(UPGRADE_MATERIAL_ID_CONVERSION) .indexOf(currentUpgradeID)]) { diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEBaseModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEBaseModule.java index 67561466ab6..c5d546d4484 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEBaseModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEBaseModule.java @@ -264,7 +264,21 @@ public void construct(ItemStack stackSize, boolean hintsOnly) { @Override public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - return structureCheck_EM(STRUCTURE_PIECE_MAIN, 3, 3, 0); + + if (!structureCheck_EM(STRUCTURE_PIECE_MAIN, 3, 3, 0)) { + return false; + } + + if (this instanceof MTEExoticModule) { + if (mOutputHatches.size() < 1) { + return false; + } + if (mOutputBusses.size() < 1) { + return false; + } + } + + return true; } @Override diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEExoticModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEExoticModule.java index c94549a5752..ee8b5396ad2 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEExoticModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEExoticModule.java @@ -26,6 +26,7 @@ import javax.annotation.Nonnull; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -36,14 +37,24 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import com.google.common.collect.ImmutableList; +import com.gtnewhorizons.modularui.api.ModularUITextures; import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.drawable.UITexture; +import com.gtnewhorizons.modularui.api.fluids.FluidTanksHandler; +import com.gtnewhorizons.modularui.api.fluids.IFluidTanksHandler; +import com.gtnewhorizons.modularui.api.math.Alignment; +import com.gtnewhorizons.modularui.api.math.Pos2d; +import com.gtnewhorizons.modularui.api.math.Size; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.api.widget.IWidgetBuilder; import com.gtnewhorizons.modularui.api.widget.Widget; import com.gtnewhorizons.modularui.common.widget.ButtonWidget; +import com.gtnewhorizons.modularui.common.widget.DrawableWidget; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.FluidSlotWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.enums.MaterialsUEVplus; import gregtech.api.enums.TierEU; @@ -61,6 +72,7 @@ import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; import tectech.recipe.TecTechRecipeMaps; +import tectech.thing.gui.TecTechUITextures; import tectech.util.CommonValues; import tectech.util.GodforgeMath; @@ -68,24 +80,23 @@ public class MTEExoticModule extends MTEBaseModule { private int numberOfFluids = 0; private int numberOfItems = 0; - private long wirelessEUt = 0; + private long ticker = 0; private long EUt = 0; private long actualParallel = 0; private boolean recipeInProgress = false; + private boolean recipeRegenerated = false; private boolean magmatterMode = false; private FluidStack[] randomizedFluidInput = new FluidStack[] {}; private ItemStack[] randomizedItemInput = new ItemStack[] {}; List inputPlasmas = new ArrayList<>(); private GTRecipe plasmaRecipe = null; - private static RecipeMap tempRecipeMap = RecipeMapBuilder.of("bye") - .maxIO(0, 0, 7, 2) - .disableRegisterNEI() - .build(); - private static final RecipeMap emptyRecipeMap = RecipeMapBuilder.of("hey") + private BigInteger powerForRecipe = BigInteger.ZERO; + private static RecipeMap tempRecipeMap = RecipeMapBuilder.of("godforgeExoticTempRecipeMap") .maxIO(0, 0, 7, 2) .disableRegisterNEI() .build(); private static final int NUMBER_OF_INPUTS = 7; + private static final int INPUT_LIST_WINDOW_ID = 10; public MTEExoticModule(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -108,56 +119,12 @@ protected ProcessingLogic createProcessingLogic() { @Override protected Stream findRecipeMatches(@Nullable RecipeMap map) { if (!recipeInProgress) { - actualParallel = getMaxParallel(); - FluidStack outputFluid = MaterialsUEVplus.QuarkGluonPlasma.getFluid(1000 * actualParallel); - tempRecipeMap = emptyRecipeMap; + if (magmatterMode) { - randomizedItemInput = getRandomItemInputs(exoticModuleMagmatterItemMap, 1); - numberOfItems = 1; - numberOfFluids = 2; - int timeAmount = GodforgeMath.getRandomIntInRange(1, 50); - int spaceAmount = GodforgeMath.getRandomIntInRange(51, 100); - randomizedFluidInput = new FluidStack[] { MaterialsUEVplus.Time.getMolten(timeAmount * 1000L), - MaterialsUEVplus.Space.getMolten(spaceAmount * 1000L) }; - inputPlasmas = new ArrayList<>( - Arrays.asList( - convertItemToPlasma(randomizedItemInput, (spaceAmount - timeAmount) * actualParallel))); - inputPlasmas.add(MaterialsUEVplus.Time.getMolten(timeAmount * actualParallel)); - inputPlasmas.add(MaterialsUEVplus.Space.getMolten(spaceAmount * actualParallel)); - outputFluid = MaterialsUEVplus.MagMatter.getMolten(144 * actualParallel); + plasmaRecipe = generateMagmatterRecipe(); } else { - numberOfFluids = GodforgeMath.getRandomIntInRange(0, NUMBER_OF_INPUTS); - numberOfItems = NUMBER_OF_INPUTS - numberOfFluids; - randomizedFluidInput = getRandomFluidInputs(exoticModulePlasmaFluidMap, numberOfFluids); - randomizedItemInput = getRandomItemInputs(exoticModulePlasmaItemMap, numberOfItems); - - if (numberOfFluids != 0) { - for (FluidStack fluidStack : randomizedFluidInput) { - fluidStack.amount = 1000 * GodforgeMath.getRandomIntInRange(1, 64); - } - } - - if (numberOfItems != 0) { - for (ItemStack itemStack : randomizedItemInput) { - itemStack.stackSize = GodforgeMath.getRandomIntInRange(1, 64); - } - } - - inputPlasmas = new ArrayList<>( - Arrays.asList(convertItemToPlasma(randomizedItemInput, actualParallel))); - inputPlasmas.addAll(Arrays.asList(convertFluidToPlasma(randomizedFluidInput, actualParallel))); + plasmaRecipe = generateQuarkGluonRecipe(); } - plasmaRecipe = new GTRecipe( - false, - null, - null, - null, - null, - inputPlasmas.toArray(new FluidStack[0]), - new FluidStack[] { outputFluid }, - 10 * SECONDS * (int) actualParallel, - (int) TierEU.RECIPE_MAX, - 0); tempRecipeMap.add(plasmaRecipe); } @@ -168,46 +135,32 @@ protected Stream findRecipeMatches(@Nullable RecipeMap map) { @NotNull @Override protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { - if (!recipeInProgress) { - maxParallel = 1; - wirelessEUt = (long) recipe.mEUt * maxParallel; - if (getUserEU(userUUID).compareTo(BigInteger.valueOf(wirelessEUt * recipe.mDuration)) < 0) { - tempRecipeMap = emptyRecipeMap; - return CheckRecipeResultRegistry.insufficientPower(wirelessEUt * recipe.mDuration); + if (!recipeInProgress || recipeRegenerated) { + powerForRecipe = BigInteger.valueOf(getProcessingVoltage()) + .multiply(BigInteger.valueOf(recipe.mDuration * actualParallel)); + if (getUserEU(userUUID).compareTo(powerForRecipe) < 0) { + tempRecipeMap.getBackend() + .clearRecipes(); + return CheckRecipeResultRegistry.insufficientStartupPower(powerForRecipe); } if (numberOfFluids != 0) { for (FluidStack fluidStack : randomizedFluidInput) { dumpFluid( mOutputHatches, - new FluidStack( - fluidStack.getFluid(), - (int) (fluidStack.amount / 1000 * actualParallel)), + new FluidStack(fluidStack.getFluid(), fluidStack.amount / 1000), false); } } if (numberOfItems != 0) { - long multiplier = actualParallel; - if (magmatterMode) { - multiplier = 1; - } for (ItemStack itemStack : randomizedItemInput) { - int stacksize = (int) (itemStack.stackSize * multiplier); - ItemStack tmpItem = itemStack.copy(); - // split itemStacks > 64 - while (stacksize >= 64) { - tmpItem.stackSize = 64; - addOutput(tmpItem); - stacksize -= 64; - } - tmpItem.stackSize = stacksize; - addOutput(tmpItem); - + addOutput(itemStack); } } recipeInProgress = true; + recipeRegenerated = false; } if (new HashSet<>(Arrays.asList(inputFluids)).containsAll(inputPlasmas)) { return CheckRecipeResultRegistry.SUCCESSFUL; @@ -218,17 +171,19 @@ protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { @NotNull @Override protected CheckRecipeResult onRecipeStart(@Nonnull GTRecipe recipe) { - wirelessEUt = (long) recipe.mEUt * maxParallel; - if (!addEUToGlobalEnergyMap(userUUID, -calculatedEut * duration)) { - return CheckRecipeResultRegistry.insufficientPower(wirelessEUt * recipe.mDuration); + EUt = calculatedEut; + powerForRecipe = BigInteger.valueOf(EUt) + .multiply(BigInteger.valueOf(duration * actualParallel)); + + if (!addEUToGlobalEnergyMap(userUUID, powerForRecipe.negate())) { + return CheckRecipeResultRegistry.insufficientStartupPower(powerForRecipe); } - addToPowerTally( - BigInteger.valueOf(calculatedEut) - .multiply(BigInteger.valueOf(duration))); + + addToPowerTally(powerForRecipe); addToRecipeTally(calculatedParallels); - EUt = calculatedEut; setCalculatedEut(0); - tempRecipeMap = emptyRecipeMap; + tempRecipeMap.getBackend() + .clearRecipes(); recipeInProgress = false; return CheckRecipeResultRegistry.SUCCESSFUL; } @@ -257,6 +212,72 @@ public RecipeMap getRecipeMap() { return TecTechRecipeMaps.godforgeExoticMatterRecipes; } + private GTRecipe generateQuarkGluonRecipe() { + actualParallel = getMaxParallel(); + tempRecipeMap.getBackend() + .clearRecipes(); + numberOfFluids = GodforgeMath.getRandomIntInRange(0, NUMBER_OF_INPUTS); + numberOfItems = NUMBER_OF_INPUTS - numberOfFluids; + randomizedFluidInput = getRandomFluidInputs(exoticModulePlasmaFluidMap, numberOfFluids); + randomizedItemInput = getRandomItemInputs(exoticModulePlasmaItemMap, numberOfItems); + + if (numberOfFluids != 0) { + for (FluidStack fluidStack : randomizedFluidInput) { + fluidStack.amount = 1000 * GodforgeMath.getRandomIntInRange(1, 64); + } + } + + if (numberOfItems != 0) { + for (ItemStack itemStack : randomizedItemInput) { + itemStack.stackSize = 9 * GodforgeMath.getRandomIntInRange(1, 7); + } + } + + inputPlasmas = new ArrayList<>(Arrays.asList(convertItemToPlasma(randomizedItemInput, 1))); + inputPlasmas.addAll(Arrays.asList(convertFluidToPlasma(randomizedFluidInput, 1))); + + return new GTRecipe( + false, + null, + null, + null, + null, + inputPlasmas.toArray(new FluidStack[0]), + new FluidStack[] { MaterialsUEVplus.QuarkGluonPlasma.getFluid(1000 * actualParallel) }, + 10 * SECONDS, + (int) TierEU.RECIPE_MAX, + 0); + } + + private GTRecipe generateMagmatterRecipe() { + actualParallel = getMaxParallel(); + tempRecipeMap.getBackend() + .clearRecipes(); + randomizedItemInput = getRandomItemInputs(exoticModuleMagmatterItemMap, 1); + numberOfItems = 1; + numberOfFluids = 2; + int timeAmount = GodforgeMath.getRandomIntInRange(1, 50); + int spaceAmount = GodforgeMath.getRandomIntInRange(51, 100); + randomizedFluidInput = new FluidStack[] { MaterialsUEVplus.Time.getMolten(timeAmount * 1000L), + MaterialsUEVplus.Space.getMolten(spaceAmount * 1000L) }; + inputPlasmas = new ArrayList<>( + Arrays.asList(convertItemToPlasma(randomizedItemInput, spaceAmount - timeAmount))); + inputPlasmas.add(MaterialsUEVplus.Time.getMolten(timeAmount)); + inputPlasmas.add(MaterialsUEVplus.Space.getMolten(spaceAmount)); + + return new GTRecipe( + false, + null, + null, + null, + null, + inputPlasmas.toArray(new FluidStack[0]), + new FluidStack[] { MaterialsUEVplus.MagMatter.getMolten(576 * actualParallel) }, + 10 * SECONDS, + (int) TierEU.RECIPE_MAX, + 0); + } + private FluidStack[] getRandomFluidInputs(HashMap fluidMap, int numberOfFluids) { int cumulativeWeight = 0; @@ -370,6 +391,7 @@ public void saveNBTData(NBTTagCompound NBT) { NBT.setBoolean("recipeInProgress", recipeInProgress); NBT.setBoolean("magmatterMode", magmatterMode); + NBT.setLong("maxParallel", actualParallel); // Store damage values/stack sizes of input plasmas NBTTagCompound fluidStackListNBTTag = new NBTTagCompound(); @@ -395,6 +417,7 @@ public void loadNBTData(final NBTTagCompound NBT) { recipeInProgress = NBT.getBoolean("recipeInProgress"); magmatterMode = NBT.getBoolean("magmatterMode"); + actualParallel = NBT.getLong("maxParallel"); // Load damage values/fluid amounts of input plasmas and convert back to fluids NBTTagCompound tempFluidTag = NBT.getCompoundTag("inputPlasmas"); @@ -410,10 +433,10 @@ public void loadNBTData(final NBTTagCompound NBT) { inputPlasmas.add(new FluidStack(fluidStack, fluidAmount)); } - FluidStack outputFluid = MaterialsUEVplus.QuarkGluonPlasma.getFluid(1000); + FluidStack outputFluid = MaterialsUEVplus.QuarkGluonPlasma.getFluid(1000L * actualParallel); if (magmatterMode) { - outputFluid = MaterialsUEVplus.MagMatter.getMolten(144); + outputFluid = MaterialsUEVplus.MagMatter.getMolten(576L * actualParallel); } tempRecipeMap.add( @@ -432,13 +455,123 @@ public void loadNBTData(final NBTTagCompound NBT) { super.loadNBTData(NBT); } + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + ticker++; + } + @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + builder.widget( + new DrawableWidget().setPos(8, 69) + .setSize(16, 16) + .addTooltip(translateToLocal("fog.button.exoticinputs.tooltip")) + .setTooltipShowUpDelay(TOOLTIP_DELAY)); super.addUIWidgets(builder, buildContext); + buildContext.addSyncedWindow(INPUT_LIST_WINDOW_ID, this::createInputListWindow); builder.widget(magmatterSwitch(builder)); + builder.widget(createExpectedInputsButton()); + builder.widget( + new DrawableWidget().setDrawable(ModularUITextures.ICON_INFO) + .setPos(8, 69) + .setSize(16, 16)); } + protected ModularWindow createInputListWindow(final EntityPlayer player) { + final int WIDTH = 100; + final int HEIGHT = 60; + final int PARENT_WIDTH = getGUIWidth(); + final int PARENT_HEIGHT = getGUIHeight(); + final Pos2d[] slotPositions = new Pos2d[] { new Pos2d(23, 35), new Pos2d(41, 35), new Pos2d(59, 35), + new Pos2d(14, 17), new Pos2d(32, 17), new Pos2d(50, 17), new Pos2d(68, 17) }; + ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT); + builder.setBackground(GTUITextures.BACKGROUND_SINGLEBLOCK_DEFAULT); + builder.setGuiTint(getGUIColorization()); + builder.setDraggable(true); + builder.setPos( + (size, window) -> Alignment.Center.getAlignedPos(size, new Size(PARENT_WIDTH, PARENT_HEIGHT)) + .add(Alignment.TopLeft.getAlignedPos(new Size(PARENT_WIDTH, PARENT_HEIGHT), new Size(WIDTH, HEIGHT))) + .subtract(100, -47)); + + IFluidTanksHandler tanksHandler = new FluidTanksHandler(7, 128000); + for (int i = 0; i < 7; i++) { + if (i < inputPlasmas.size()) { + FluidStack plasma = inputPlasmas.get(i); + tanksHandler.setFluidInTank(i, plasma.getFluid(), plasma.amount); + } + builder.widget( + new DrawableWidget().setDrawable(ModularUITextures.FLUID_SLOT) + .setSize(18, 18) + .setPos(slotPositions[i])) + .widget( + new FluidSlotWidget(tanksHandler, i).setInteraction(false, false) + .setSize(18, 18) + .setPos(slotPositions[i]) + .attachSyncer( + new FakeSyncWidget.BooleanSyncer(() -> recipeInProgress, val -> recipeInProgress = val), + builder, + (widget, val) -> widget.checkNeedsRebuild())); + } + + builder.widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.expectedinputs")) + .setDefaultColor(EnumChatFormatting.BLACK) + .setTextAlignment(Alignment.Center) + .setSize(100, 9) + .setPos(0, 6)); + + builder.widget(new ButtonWidget().setOnClick((clickData, widget) -> { + if (!widget.isClient() && ticker > 1200) { + + if (magmatterMode) { + plasmaRecipe = generateMagmatterRecipe(); + } else { + plasmaRecipe = generateQuarkGluonRecipe(); + } + recipeRegenerated = true; + tempRecipeMap.add(plasmaRecipe); + + for (int i = 0; i < 7; i++) { + if (i < inputPlasmas.size()) { + FluidStack plasma = inputPlasmas.get(i); + tanksHandler.setFluidInTank(i, plasma.getFluid(), plasma.amount); + } + } + ticker = 0; + widget.getContext() + .closeWindow(INPUT_LIST_WINDOW_ID); + widget.getContext() + .openSyncedWindow(INPUT_LIST_WINDOW_ID); + } + }) + .setPlayClickSound(true) + .setBackground(TecTechUITextures.OVERLAY_CYCLIC_BLUE) + .dynamicTooltip(this::refreshTooltip) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setSize(16, 16) + .setPos(5, 37) + .attachSyncer( + new FakeSyncWidget.LongSyncer(() -> ticker, val -> ticker = val), + builder, + (widget, val) -> widget.notifyTooltipChange())); + + return builder.build(); + } + + private Widget createExpectedInputsButton() { + return new ButtonWidget().setOnClick((clickData, widget) -> { + if (!widget.isClient()) { + widget.getContext() + .openSyncedWindow(INPUT_LIST_WINDOW_ID); + } + }) + .setPlayClickSound(true) + .setSize(16, 16) + .setPos(8, 69); + } + protected ButtonWidget magmatterSwitch(IWidgetBuilder builder) { Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { if (isMagmatterCapable) { @@ -482,6 +615,18 @@ protected ButtonWidget magmatterSwitch(IWidgetBuilder builder) { return (ButtonWidget) button; } + private List refreshTooltip() { + if (ticker > 1200) { + return ImmutableList.of(translateToLocal("fog.button.reciperefresh.tooltip")); + } + + return ImmutableList.of( + translateToLocal("fog.button.refreshtimer.tooltip") + " " + + (int) Math.ceil((1200 - ticker) / 20d) + + " " + + translateToLocal("fog.button.seconds")); + } + public boolean isMagmatterModeOn() { return magmatterMode; } @@ -519,6 +664,8 @@ public MultiblockTooltipBuilder createTooltip() { .addStructureInfo( EnumChatFormatting.GOLD + "5" + EnumChatFormatting.GRAY + " Celestial Matter Guidance Casing") .addStructureInfo(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + " Stellar Energy Siphon Casing") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Output Hatch") + .addStructureInfo("Requires " + EnumChatFormatting.GOLD + 1 + EnumChatFormatting.GRAY + " Output Bus") .toolTipFinisher(CommonValues.GODFORGE_MARK); return tt; } @@ -535,9 +682,16 @@ public String[] getInfoData() { + formatNumbers(mMaxProgresstime / 20) + RESET + " s"); - str.add("Currently using: " + RED + formatNumbers(EUt) + RESET + " EU/t"); + str.add( + "Currently using: " + RED + + (getBaseMetaTileEntity().isActive() ? formatNumbers(EUt * actualParallel) : "0") + + RESET + + " EU/t"); str.add(YELLOW + "Max Parallel: " + RESET + formatNumbers(getMaxParallel())); - str.add(YELLOW + "Current Parallel: " + RESET + formatNumbers(getMaxParallel())); + str.add( + YELLOW + "Current Parallel: " + + RESET + + (getBaseMetaTileEntity().isActive() ? formatNumbers(getMaxParallel()) : "0")); str.add(YELLOW + "Recipe time multiplier: " + RESET + formatNumbers(getSpeedBonus())); str.add(YELLOW + "Energy multiplier: " + RESET + formatNumbers(getEnergyDiscount())); str.add(YELLOW + "Recipe time divisor per non-perfect OC: " + RESET + formatNumbers(getOverclockTimeFactor())); diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEMoltenModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEMoltenModule.java index 5cdb0bc95cb..e9907a86265 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEMoltenModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEMoltenModule.java @@ -1,11 +1,6 @@ package tectech.thing.metaTileEntity.multi.godforge_modules; -import static gregtech.api.util.GTOreDictUnificator.getAssociation; -import static gregtech.api.util.GTRecipeBuilder.BUCKETS; -import static gregtech.api.util.GTRecipeBuilder.INGOTS; import static gregtech.api.util.GTUtility.formatNumbers; -import static gregtech.api.util.ParallelHelper.addFluidsLong; -import static gregtech.api.util.ParallelHelper.addItemsLong; import static gregtech.common.misc.WirelessNetworkManager.addEUToGlobalEnergyMap; import static gregtech.common.misc.WirelessNetworkManager.getUserEU; import static net.minecraft.util.EnumChatFormatting.GREEN; @@ -18,25 +13,20 @@ import javax.annotation.Nonnull; -import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.oredict.OreDictionary; import org.jetbrains.annotations.NotNull; -import gregtech.api.enums.Materials; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; -import gregtech.api.objects.ItemData; +import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.util.GTRecipe; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; -import gregtech.api.util.ParallelHelper; +import tectech.recipe.TecTechRecipeMaps; import tectech.util.CommonValues; public class MTEMoltenModule extends MTEBaseModule { @@ -63,12 +53,9 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { protected ProcessingLogic createProcessingLogic() { return new ProcessingLogic() { - private FluidStack[] meltableItems; - @NotNull @Override protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { - if (recipe.mSpecialValue > getHeat()) { return CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); } @@ -76,31 +63,6 @@ protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { if (getUserEU(userUUID).compareTo(BigInteger.valueOf(wirelessEUt * recipe.mDuration)) < 0) { return CheckRecipeResultRegistry.insufficientPower(wirelessEUt * recipe.mDuration); } - - meltableItems = new FluidStack[recipe.mOutputs.length]; - for (int i = 0; i < recipe.mOutputs.length; i++) { - ItemStack item = recipe.getOutput(i); - if (item == null) { - continue; - } - // if this is null it has to be a gt++ material - ItemData data = getAssociation(item); - Materials mat = data == null ? null : data.mMaterial.mMaterial; - if (mat != null) { - if (mat.mStandardMoltenFluid != null) { - meltableItems[i] = mat.getMolten(INGOTS); - } else if (mat.mFluid != null) { - meltableItems[i] = mat.getFluid(BUCKETS); - } - } else { - String dict = OreDictionary.getOreName(OreDictionary.getOreIDs(item)[0]); - // substring 8 because ingotHot is 8 characters long - String strippedOreDict = dict.substring(8); - meltableItems[i] = FluidRegistry - .getFluidStack("molten." + strippedOreDict.toLowerCase(), INGOTS); - } - } - return CheckRecipeResultRegistry.SUCCESSFUL; } @@ -132,47 +94,6 @@ protected CheckRecipeResult onRecipeStart(@Nonnull GTRecipe recipe) { setCalculatedEut(0); return CheckRecipeResultRegistry.SUCCESSFUL; } - - @Nonnull - @Override - protected ParallelHelper createParallelHelper(@Nonnull GTRecipe recipe) { - return super.createParallelHelper(recipe).setCustomItemOutputCalculation(currentParallel -> { - ArrayList outputItems = new ArrayList<>(); - for (int i = 0; i < recipe.mOutputs.length; i++) { - ItemStack item = recipe.getOutput(i); - if (item == null || meltableItems[i] != null) { - continue; - } - ItemStack itemToAdd = item.copy(); - addItemsLong(outputItems, itemToAdd, (long) item.stackSize * currentParallel); - } - return outputItems.toArray(new ItemStack[0]); - }) - .setCustomFluidOutputCalculation(currentParallel -> { - ArrayList fluids = new ArrayList<>(); - - for (int i = 0; i < recipe.mOutputs.length; i++) { - FluidStack fluid = meltableItems[i]; - if (fluid == null) { - continue; - } - FluidStack fluidToAdd = fluid.copy(); - long fluidAmount = (long) fluidToAdd.amount * recipe.mOutputs[i].stackSize - * currentParallel; - addFluidsLong(fluids, fluidToAdd, fluidAmount); - } - - for (int i = 0; i < recipe.mFluidOutputs.length; i++) { - FluidStack fluid = recipe.getFluidOutput(i); - if (fluid == null) { - continue; - } - FluidStack fluidToAdd = fluid.copy(); - addFluidsLong(fluids, fluidToAdd, (long) fluidToAdd.amount * currentParallel); - } - return fluids.toArray(new FluidStack[0]); - }); - } }; } @@ -186,6 +107,11 @@ protected void setProcessingLogicPower(ProcessingLogic logic) { logic.setEuModifier(getEnergyDiscount()); } + @Override + public RecipeMap getRecipeMap() { + return TecTechRecipeMaps.godforgeMoltenRecipes; + } + @Override public String[] getInfoData() { ArrayList str = new ArrayList<>(); @@ -198,9 +124,16 @@ public String[] getInfoData() { + formatNumbers(mMaxProgresstime / 20) + RESET + " s"); - str.add("Currently using: " + RED + formatNumbers(EUt) + RESET + " EU/t"); + str.add( + "Currently using: " + RED + + (getBaseMetaTileEntity().isActive() ? formatNumbers(EUt) : "0") + + RESET + + " EU/t"); str.add(YELLOW + "Max Parallel: " + RESET + formatNumbers(getMaxParallel())); - str.add(YELLOW + "Current Parallel: " + RESET + formatNumbers(currentParallel)); + str.add( + YELLOW + "Current Parallel: " + + RESET + + (getBaseMetaTileEntity().isActive() ? formatNumbers(currentParallel) : "0")); str.add(YELLOW + "Heat Capacity: " + RESET + formatNumbers(getHeat())); str.add(YELLOW + "Effective Heat Capacity: " + RESET + formatNumbers(getHeatForOC())); str.add(YELLOW + "Recipe time multiplier: " + RESET + formatNumbers(getSpeedBonus())); @@ -213,7 +146,7 @@ public String[] getInfoData() { public MultiblockTooltipBuilder createTooltip() { final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); tt.addMachineType("Blast Smelter") - .addInfo("Controller block for the Helioflux Meltig Core, a module of the Godforge.") + .addInfo("Controller block for the Helioflux Melting Core, a module of the Godforge.") .addInfo("Must be part of a Godforge to function.") .addInfo("Used for high temperature material liquefaction.") .addInfo(TOOLTIP_BAR) diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEPlasmaModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEPlasmaModule.java index 7923089f8b6..e0c2e8965cd 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEPlasmaModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTEPlasmaModule.java @@ -1,6 +1,8 @@ package tectech.thing.metaTileEntity.multi.godforge_modules; import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; +import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_MULTISTEP; +import static gregtech.api.util.GTRecipeConstants.FOG_PLASMA_TIER; import static gregtech.api.util.GTUtility.formatNumbers; import static gregtech.common.misc.WirelessNetworkManager.addEUToGlobalEnergyMap; import static gregtech.common.misc.WirelessNetworkManager.getUserEU; @@ -11,7 +13,6 @@ import java.math.BigInteger; import java.util.ArrayList; -import java.util.Objects; import javax.annotation.Nonnull; @@ -42,6 +43,7 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; +import tectech.loader.TecTechConfig; import tectech.recipe.TecTechRecipeMaps; import tectech.util.CommonValues; @@ -49,7 +51,7 @@ public class MTEPlasmaModule extends MTEBaseModule { private long EUt = 0; private int currentParallel = 0; - private boolean debug = false; + private boolean debug = TecTechConfig.DEBUG_MODE; private int inputMaxParallel = 0; public MTEPlasmaModule(int aID, String aName, String aNameRegional) { @@ -78,8 +80,8 @@ protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { if (getUserEU(userUUID).compareTo(BigInteger.valueOf(wirelessEUt * recipe.mDuration)) < 0) { return CheckRecipeResultRegistry.insufficientPower(wirelessEUt * recipe.mDuration); } - if (recipe.mSpecialValue > getPlasmaTier() - || Objects.equals(recipe.mSpecialItems.toString(), "true") && !isMultiStepPlasmaCapable) { + if (recipe.getMetadataOrDefault(FOG_PLASMA_TIER, 0) > getPlasmaTier() + || (recipe.getMetadataOrDefault(FOG_PLASMA_MULTISTEP, false) && !isMultiStepPlasmaCapable)) { return SimpleCheckRecipeResult.ofFailure("missing_upgrades"); } return CheckRecipeResultRegistry.SUCCESSFUL; @@ -201,9 +203,16 @@ public String[] getInfoData() { + formatNumbers(mMaxProgresstime / 20) + RESET + " s"); - str.add("Currently using: " + RED + formatNumbers(EUt) + RESET + " EU/t"); + str.add( + "Currently using: " + RED + + (getBaseMetaTileEntity().isActive() ? formatNumbers(EUt) : "0") + + RESET + + " EU/t"); str.add(YELLOW + "Max Parallel: " + RESET + formatNumbers(getMaxParallel())); - str.add(YELLOW + "Current Parallel: " + RESET + formatNumbers(currentParallel)); + str.add( + YELLOW + "Current Parallel: " + + RESET + + (getBaseMetaTileEntity().isActive() ? formatNumbers(currentParallel) : "0")); str.add(YELLOW + "Recipe time multiplier: " + RESET + formatNumbers(getSpeedBonus())); str.add(YELLOW + "Energy multiplier: " + RESET + formatNumbers(getEnergyDiscount())); str.add(YELLOW + "Recipe time divisor per non-perfect OC: " + RESET + formatNumbers(getOverclockTimeFactor())); diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTESmeltingModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTESmeltingModule.java index 8c45060653c..08d99bde8c4 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTESmeltingModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge_modules/MTESmeltingModule.java @@ -75,6 +75,11 @@ public Collection> getAvailableRecipeMaps() { return Arrays.asList(RecipeMaps.blastFurnaceRecipes, RecipeMaps.furnaceRecipes); } + @Override + public int getRecipeCatalystPriority() { + return -10; + } + long wirelessEUt = 0; @Override @@ -200,9 +205,16 @@ public String[] getInfoData() { + formatNumbers(mMaxProgresstime / 20) + RESET + " s"); - str.add("Currently using: " + RED + formatNumbers(EUt) + RESET + " EU/t"); + str.add( + "Currently using: " + RED + + (getBaseMetaTileEntity().isActive() ? formatNumbers(EUt) : "0") + + RESET + + " EU/t"); str.add(YELLOW + "Max Parallel: " + RESET + formatNumbers(getMaxParallel())); - str.add(YELLOW + "Current Parallel: " + RESET + formatNumbers(currentParallel)); + str.add( + YELLOW + "Current Parallel: " + + RESET + + (getBaseMetaTileEntity().isActive() ? formatNumbers(currentParallel) : "0")); str.add(YELLOW + "Heat Capacity: " + RESET + formatNumbers(getHeat())); str.add(YELLOW + "Effective Heat Capacity: " + RESET + formatNumbers(getHeatForOC())); str.add(YELLOW + "Recipe time multiplier: " + RESET + formatNumbers(getSpeedBonus())); diff --git a/src/main/java/tectech/util/FaceCulledRenderBlocks.java b/src/main/java/tectech/util/FaceCulledRenderBlocks.java new file mode 100644 index 00000000000..468ac527a00 --- /dev/null +++ b/src/main/java/tectech/util/FaceCulledRenderBlocks.java @@ -0,0 +1,62 @@ +package tectech.util; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +public class FaceCulledRenderBlocks extends RenderBlocks { + + FaceVisibility faceVisibility; + + public FaceCulledRenderBlocks(IBlockAccess world) { + super(world); + } + + public void setFaceVisibility(FaceVisibility faceVisibility) { + this.faceVisibility = faceVisibility; + } + + @Override + public void renderFaceYNeg(Block block, double x, double y, double z, IIcon icon) { + if (this.faceVisibility.bottom) { + super.renderFaceYNeg(block, 0, 0, 0, icon); + } + } + + @Override + public void renderFaceYPos(Block block, double x, double y, double z, IIcon icon) { + if (this.faceVisibility.top) { + super.renderFaceYPos(block, 0, 0, 0, icon); + } + } + + @Override + public void renderFaceZNeg(Block block, double x, double y, double z, IIcon icon) { + if (this.faceVisibility.back) { + super.renderFaceZNeg(block, 0, 0, 0, icon); + } + } + + @Override + public void renderFaceZPos(Block block, double x, double y, double z, IIcon icon) { + if (this.faceVisibility.front) { + super.renderFaceZPos(block, 0, 0, 0, icon); + } + } + + @Override + public void renderFaceXNeg(Block block, double x, double y, double z, IIcon icon) { + if (this.faceVisibility.left) { + super.renderFaceXNeg(block, 0, 0, 0, icon); + } + } + + @Override + public void renderFaceXPos(Block block, double x, double y, double z, IIcon icon) { + if (this.faceVisibility.right) { + super.renderFaceXPos(block, 0, 0, 0, icon); + } + } + +} diff --git a/src/main/java/tectech/util/FaceVisibility.java b/src/main/java/tectech/util/FaceVisibility.java new file mode 100644 index 00000000000..da981a98d8a --- /dev/null +++ b/src/main/java/tectech/util/FaceVisibility.java @@ -0,0 +1,12 @@ +package tectech.util; + +public class FaceVisibility { + + public boolean front = true, back = true; + public boolean left = true, right = true; + public boolean top = true, bottom = true; + + public boolean isEntireObscured() { + return !front && !back && !left && !right && !top && !bottom; + } +} diff --git a/src/main/java/tectech/util/GodforgeMath.java b/src/main/java/tectech/util/GodforgeMath.java index c11a71be027..a3105e08a12 100644 --- a/src/main/java/tectech/util/GodforgeMath.java +++ b/src/main/java/tectech/util/GodforgeMath.java @@ -138,7 +138,7 @@ public static void calculateMaxParallelForModules(MTEBaseModule module, MTEForge baseParallel = 384; } if (module instanceof MTEExoticModule) { - baseParallel = 36; + baseParallel = 64; } if (module instanceof MTEMoltenModule @@ -178,19 +178,18 @@ public static void calculateMaxParallelForModules(MTEBaseModule module, MTEForge } } - int maxParallel = (int) (baseParallel * node53 - * fuelFactorMultiplier - * heatMultiplier - * upgradeAmountMultiplier); + float totalBonuses = node53 * fuelFactorMultiplier * heatMultiplier * upgradeAmountMultiplier; if (module instanceof MTEExoticModule) { if (godforge.isUpgradeActive(25)) { - maxParallel = (int) Math.max(9 * Math.floor(Math.sqrt(maxParallel) / 9), 36); + totalBonuses = (float) Math.sqrt(totalBonuses); } else { - maxParallel = baseParallel; + totalBonuses = 1; } } + int maxParallel = (int) (baseParallel * totalBonuses); + module.setMaxParallel(maxParallel); } diff --git a/src/main/java/tectech/util/StructureVBO.java b/src/main/java/tectech/util/StructureVBO.java new file mode 100644 index 00000000000..1e1206d4c93 --- /dev/null +++ b/src/main/java/tectech/util/StructureVBO.java @@ -0,0 +1,114 @@ +package tectech.util; + +import java.util.HashMap; +import java.util.HashSet; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; + +import org.apache.commons.lang3.tuple.Pair; + +import com.gtnewhorizon.gtnhlib.client.renderer.CapturingTessellator; +import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager; +import com.gtnewhorizon.gtnhlib.client.renderer.vbo.VertexBuffer; +import com.gtnewhorizon.gtnhlib.client.renderer.vertex.DefaultVertexFormat; + +public class StructureVBO { + + private String[][] structure; + + private HashSet values = new HashSet<>(); + private HashMap> mapper = new HashMap<>(); + + public StructureVBO assignStructure(String[][] structure) { + this.structure = structure; + return this; + } + + public StructureVBO addMapping(char letter, Block block) { + mapper.put(letter, Pair.of(block, 0)); + return this; + } + + public StructureVBO addMapping(char letter, Block block, int meta) { + mapper.put(letter, Pair.of(block, meta)); + return this; + } + + public TextureUpdateRequester getTextureUpdateRequestor() { + TextureUpdateRequester textureUpdateRequester = new TextureUpdateRequester(); + for (char key : mapper.keySet()) { + Pair pair = mapper.get(key); + textureUpdateRequester.add(pair.getLeft(), pair.getRight()); + } + return textureUpdateRequester; + } + + private boolean isOpaqueAt(int x, int y, int z) { + char letter = structure[x][y].charAt(z); + if (letter == ' ') return false; + Pair info = mapper.get(letter); + if (info == null) return false; + if (info.getLeft() == Blocks.air) return false; + return info.getLeft() + .isOpaqueCube(); + } + + private FaceVisibility getVisibleFaces(int x, int y, int z) { + FaceVisibility visibility = new FaceVisibility(); + int maxX = structure.length - 1; + int maxY = structure[0].length - 1; + int maxZ = structure[0][0].length() - 1; + // X is ordered from left to right + if ((x > 0) && (isOpaqueAt(x - 1, y, z))) visibility.left = false; + if ((x < maxX) && (isOpaqueAt(x + 1, y, z))) visibility.right = false; + // Y is ordered from top to bottom + if ((y > 0) && (isOpaqueAt(x, y - 1, z))) visibility.top = false; + if ((y < maxY) && (isOpaqueAt(x, y + 1, z))) visibility.bottom = false; + // Z is ordered from front to back + if ((z > 0) && (isOpaqueAt(x, y, z - 1))) visibility.back = false; + if ((z < maxZ) && (isOpaqueAt(x, y, z + 1))) visibility.front = false; + return visibility; + } + + public VertexBuffer build() { + TessellatorManager.startCapturing(); + CapturingTessellator tess = (CapturingTessellator) TessellatorManager.get(); + FaceCulledRenderBlocks renderer = new FaceCulledRenderBlocks(Minecraft.getMinecraft().theWorld); + renderer.enableAO = false; + + for (int x = 0; x < structure.length; x++) { + String[] plane = structure[x]; + for (int y = 0; y < plane.length; y++) { + String row = plane[y]; + for (int z = 0; z < row.length(); z++) { + char letter = row.charAt(z); + if (letter == ' ') continue; + Pair info = mapper.get(letter); + if (info == null) { + values.add(letter); + continue; + } + if (info.getLeft() == Blocks.air) continue; + + FaceVisibility faceInfo = getVisibleFaces(x, y, z); + + if (faceInfo.isEntireObscured()) continue; + + renderer.setFaceVisibility(faceInfo); + + // The floor division is intended to produce proper offsets + tess.setTranslation( + -structure.length / 2f + x, + plane.length / 2f - y, // y needs to be drawn from top to bottom + -row.length() / 2f + z); + + renderer.renderBlockAsItem(info.getLeft(), info.getRight(), 1f); + } + } + } + + return TessellatorManager.stopCapturingToVBO(DefaultVertexFormat.POSITION_TEXTURE_NORMAL); + } +} diff --git a/src/main/java/tectech/util/TextureUpdateRequester.java b/src/main/java/tectech/util/TextureUpdateRequester.java new file mode 100644 index 00000000000..250686686f5 --- /dev/null +++ b/src/main/java/tectech/util/TextureUpdateRequester.java @@ -0,0 +1,38 @@ +package tectech.util; + +import java.util.HashSet; + +import net.minecraft.block.Block; +import net.minecraft.client.Minecraft; + +import org.apache.commons.lang3.tuple.Pair; +import org.lwjgl.opengl.GL11; + +import com.gtnewhorizon.gtnhlib.client.renderer.CapturingTessellator; +import com.gtnewhorizon.gtnhlib.client.renderer.TessellatorManager; +import com.gtnewhorizon.gtnhlib.client.renderer.vertex.DefaultVertexFormat; + +// Ugly hack to wake up angelica/hodgepodge to update the texture by fake rendering out a block +public class TextureUpdateRequester { + + private final HashSet> blocks = new HashSet<>(); + + public void add(Block block, int meta) { + blocks.add(Pair.of(block, meta)); + } + + // Using capturing tesselator just to make sure we dont render anything out + public void requestUpdate() { + GL11.glPushMatrix(); + TessellatorManager.startCapturing(); + CapturingTessellator tess = (CapturingTessellator) TessellatorManager.get(); + FaceCulledRenderBlocks renderer = new FaceCulledRenderBlocks(Minecraft.getMinecraft().theWorld); + renderer.setFaceVisibility(new FaceVisibility()); + for (Pair block : blocks) { + renderer.renderBlockAsItem(block.getLeft(), block.getRight(), 1f); + } + tess.setTranslation(0, 0, 0); + TessellatorManager.stopCapturingToBuffer(DefaultVertexFormat.POSITION_TEXTURE_NORMAL); + GL11.glPopMatrix(); + } +} diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index e683876e2dc..b970024c971 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -889,6 +889,7 @@ achievement.gt.stabilisation_field_generator.8=Gallifreyan Stabilisation Field G # Forge of the Gods / Godforge fog.upgrade.confirm=Construct +fog.upgrade.respec=Respec fog.upgrade.tt.0=upgrade start fog.upgrade.tt.1=Improved Gravitational Convection Coils @@ -1009,7 +1010,7 @@ fog.upgrade.text.19=Improves the EBF energy reduction heat bonus from 5% to 8% a fog.upgrade.text.20=EBF heat bonuses are granted above 30,000K, but the heat value used in heat bonus calculations is determined by this formula: Actual Heat = 30000 + (Current Heat - 30000)^0.85 fog.upgrade.text.21=Unlocks a multiplier to maximum parallel based on total amount of purchased upgrades. This bonus is calculated via this formula: Multiplier = 1 + Upgrade Amount / 5 fog.upgrade.text.22=Improves IGCC based on current maximum parallel. Improved Formula: Multiplier = (1 / Heat^0.01) / (Parallel^0.02) -fog.upgrade.text.23=Increases maximum processing voltage by 1 per active ring. +fog.upgrade.text.23=Increases maximum processing voltage by 1 tier per active ring. fog.upgrade.text.24=Allows the Heliothermal Plasma Fabricator to process up to T5 plasmas. fog.upgrade.text.25=Allows the Heliofusion Exoticizer to be affected by other upgrade benefits, but those benefits are square rooted first. The overclock bonus is adjusted via the following formula: OC Factor = 2 + (Base OC Factor - 2)^2 fog.upgrade.text.26=Allows construction of the second ring and adds 4 module slots. @@ -1038,6 +1039,11 @@ fog.button.materialrequirementsmet.tooltip=All materials supplied fog.button.materialrequirements.tooltip.clickhere=Click to open material insertion window fog.button.ejection.tooltip=Toggle Graviton Shard Ejection fog.button.formatting.tooltip=Toggle Number Formatting +fog.button.exoticinputs.tooltip=Click to display expected inputs +fog.button.reciperefresh.tooltip=Click to reset recipe +fog.button.refreshtimer.tooltip=Reset ready in +fog.button.seconds=Seconds +fog.button.thanks.tooltip=Open List of Contributors achievement.gt.blockmachines.multimachine.em.forge_of_gods=Forge of the Gods @@ -1079,6 +1085,7 @@ gt.blockmachines.multimachine.FOG.milestonecomplete=Milestone Complete gt.blockmachines.multimachine.FOG.milestoneinfo=View Milestone Progress gt.blockmachines.multimachine.FOG.inversionactive=Inversion Active gt.blockmachines.multimachine.FOG.inversion=Inversion +gt.blockmachines.multimachine.FOG.expectedinputs=Expected Inputs gt.blockmachines.multimachine.FOG.inversioninfotext=Once all milestones of the Forge reach tier 7, inversion activates. This uncaps the maximum tier of all milestones and allows to scale infinitely. The scaling of each milestone changes from exponential to linear, but the granted graviton shard amount keeps increasing. The amount of progress needed for each subsequent milestone is as much as needed for the 7th tier of each milestone. The Composition milestone is once again an exception, as that continues to scale by 1 each tier, with it's own formula for calculating progress. Each module type is given a value, ranging from 1 for the Helioflare Power Forge to 5 for the Heliofusion Exoticizer in magmatter mode, then the amount of each module present is substracted by 1 and multiplied by its value. These values are added up and divided by 5, this is the final milestone tier on top of the base 7. gt.blockmachines.multimachine.FOG.powermilestone=Charge gt.blockmachines.multimachine.FOG.recipemilestone=Conversion @@ -1099,9 +1106,24 @@ gt.blockmachines.multimachine.FOG.modules=Modules gt.blockmachines.multimachine.FOG.upgrades=Upgrades gt.blockmachines.multimachine.FOG.milestones=Milestones gt.blockmachines.multimachine.FOG.fuelinfotext=Once the structure of the Forge is built and the multiblock is formed, just simply turning it on is not sufficient to make it functional. The Forge must be supplied with a certain amount of Star Fuel (the item) to actually boot up. The amount of Star Fuel needed depends on the current fuel consumption factor, which can be set in the fuel configuration menu. By default the maximum is 5, but it can be increased later on with upgrades. Star Fuel scaling is as follows: factor*25*1.2^factor. Star Fuel can be supplied via an input bus, it gets consumed periodically and stored internally. Once there is enough Star Fuel stored in the multi, it turns on for real (allowing modules to connect) and converts the consumed Star Fuel into stored Stellar Fuel. From this point onwards, the Forge must be fueled via one of the liquid fuels (type can be selected in the fuel config menu). If there isn't enough of the selected fuel present in the input hatch, the stored fuel amount will decrease and if it reaches 0, the Forge enters the previous 'off' state where modules disconnect and it has to be supplied with Star Fuel again. The amount of internally stored Stellar Fuel (liquid) can be increased by turning on battery charging, this will cause the fuel usage to double, but half of it will be stored in the internal battery. -gt.blockmachines.multimachine.FOG.moduleinfotext=There are 4 types of modules that can be used in the Forge, the Helioflare Power Forge, Helioflux Melting Core, Heliothermal Plasma Fabricator and Heliofusion Exoticizer. These modules are separate multiblocks that have to be built into the Godforge structure at their designated spots. Once built, these modules have to connect to the Godforge, which happens automatically if all requirements for the respective module are met. Alternatively, there is a button to refresh their status without waiting for the timer. Each of these modules has its specialized functionality & requirements and is affected differently by certain upgrades. The first unlocked module is the §BHelioflare Power Forge§6, which simply put is a blast furnace even more powerful than the mega version. Additionally, this module has a furnace mode, turning it into a hyper powerful multi smelter. This module is unlocked by default and has 1024 base parallel. The second unlock is the §BHelioflux Melting Core§6, which also processes blast furnace recipes, but with a twist, the outputs are ejected in their molten form instead of hot/regular ingots. If an output does not have a molten form, it will output its regular form. This module has to be unlocked by an upgrade to function and has 512 base parallel. The third module is the §BHeliothermal Plasma Fabricator§6, which possesses a unique recipemap featuring direct material to plasma conversion recipes. These recipes are grouped by two properties, fusion tier and steps required, limiting which recipes can be processed before their respective upgrades are unlocked. Unlike regular fusion, these recipes produce the plasma of the input material. This module has 384 base parallel. The fourth and last module is the §BHeliofusion Exoticizer§6, a module capable of producing quark gluon plasma and later on magmatter. This module has unique automation challenges for both materials, so it is recommended to have two of these, as they have to be locked to either one of the materials. The common rule for both modes' automation challenges is as follows: the module outputs materials at the start of a recipe cycle and waits for the correct inputs to arrive before starting the actual processing of the output material. If producing quark-gluon plasma, the module outputs up 7 different fluids/tiny piles with amounts between 1 and 64, and their corresponding plasmas and amounts have to be returned in order for the recipe to process. For each L of fluid, a bucket of plasma and for each tiny pile an ingot's worth of plasma must be returned for the recipe to work. The amount of initial outputs scales with parallel amount. If magmatter mode is active, the automation challenge changes. Now the module outputs 1-50L of tachyon rich temporal fluid, 51-100L of spatially enlarged fluid and one tiny pile of a high tier material. The challenge is to return both the tachyon rich and spatially enlarged fluids, plus as much plasma of the tiny pile's material (in ingots) as the difference between the amounts of spatially enlarged and tachyon rich fluid. Once all of these have been returned in the correct amounts, the recipe will start to process and output magmatter. The initial input amounts (except the tiny pile) scale with parallel. This module has 36 base parallel and only scales in multiples of nine. -gt.blockmachines.multimachine.FOG.upgradeinfotext=Uprades are the heart and soul of the Godforge, they unlock most of its functionality and processing power. The upgrade tree can be accessed via its button on the main gui and each upgrade node can be clicked for more information on its effects and unlock requirements. In general, each upgrade can only be unlocked if the prior one is unlocked and there are enough available graviton shards. One exception to this is the first upgrade, as that one has no prior upgrade. Some upgrades can also have extra material costs, which are denoted next to the unlock button if applicable. If an upgrade has more than 1 connected prior upgrade, then there are two options, either the upgrade requires ALL connected prior upgrades or AT LEAST ONE (indicated by the connection's color). Upgrades can be refunded by simply pressing the unlock button again, but this only works if ALL connected later upgrades are not active/unlocked. The block of upgrades following the unlock of the Heliufusion Exoticizer module are special, as they are what is considered §Bthe Split§6. As the name suggests, only one path out of the three may be chosen at first, and the others will be locked. Each path has specialized buffs that are primarily targeted towards a specific module, and thus affect other module types with reduced effect (unless stated otherwise). The amount of unlockable paths depends on the amount of rings the Godforge has, which in turn are limited by later upgrades. +gt.blockmachines.multimachine.FOG.moduleinfotext=There are 4 types of modules that can be used in the Forge, the Helioflare Power Forge, Helioflux Melting Core, Heliothermal Plasma Fabricator and Heliofusion Exoticizer. These modules are separate multiblocks that have to be built into the Godforge structure at their designated spots. Once built, these modules have to connect to the Godforge, which happens automatically if all requirements for the respective module are met. Alternatively, there is a button to refresh their status without waiting for the timer. Each of these modules has its specialized functionality & requirements and is affected differently by certain upgrades. The first unlocked module is the §BHelioflare Power Forge§6, which simply put is a blast furnace even more powerful than the mega version. Additionally, this module has a furnace mode, turning it into a hyper powerful multi smelter. This module is unlocked by default and has 1024 base parallel. The second unlock is the §BHelioflux Melting Core§6, which also processes blast furnace recipes, but with a twist, the outputs are ejected in their molten form instead of hot/regular ingots. If an output does not have a molten form, it will output its regular form. This module has to be unlocked by an upgrade to function and has 512 base parallel. The third module is the §BHeliothermal Plasma Fabricator§6, which possesses a unique recipemap featuring direct material to plasma conversion recipes. These recipes are grouped by two properties, fusion tier and steps required, limiting which recipes can be processed before their respective upgrades are unlocked. Unlike regular fusion, these recipes produce the plasma of the input material. This module has 384 base parallel. The fourth and last module is the §BHeliofusion Exoticizer§6, a module capable of producing quark gluon plasma and later on magmatter. This module has unique automation challenges for both materials, so it is recommended to have two of these, as they have to be locked to either one of the materials. The common rule for both modes' automation challenges is as follows: the module outputs materials at the start of a recipe cycle and waits for the correct inputs to arrive before starting the actual processing of the output material. If producing quark-gluon plasma, the module outputs up to 7 different fluids/tiny piles with amounts between 1 and 64, and their corresponding plasmas and amounts have to be returned in order for the recipe to process. For each L of fluid, a bucket of plasma and for each tiny pile an ingot's worth of plasma must be returned for the recipe to work. If magmatter mode is active, the automation challenge changes. Now the module outputs 1-50L of tachyon rich temporal fluid, 51-100L of spatially enlarged fluid and one tiny pile of a high tier material. The challenge is to return both the tachyon rich and spatially enlarged fluids, plus as much plasma of the tiny pile's material (in ingots) as the difference between the amounts of spatially enlarged and tachyon rich fluid. Once all of these have been returned in the correct amounts, the recipe will start to process and output magmatter. This module has 64 base parallel. +gt.blockmachines.multimachine.FOG.upgradeinfotext=Upgrades are the heart and soul of the Godforge, they unlock most of its functionality and processing power. The upgrade tree can be accessed via its button on the main gui and each upgrade node can be clicked for more information on its effects and unlock requirements. In general, each upgrade can only be unlocked if the prior one is unlocked and there are enough available graviton shards. One exception to this is the first upgrade, as that one has no prior upgrade. Some upgrades can also have extra material costs, which are denoted next to the unlock button if applicable. If an upgrade has more than 1 connected prior upgrade, then there are two options, either the upgrade requires ALL connected prior upgrades or AT LEAST ONE (indicated by the connection's color, red means ALL, blue means AT LEAST ONE). Upgrades can be refunded by simply pressing the unlock button again, but this only works if ALL connected later upgrades are not active/unlocked. The block of upgrades following the unlock of the Heliufusion Exoticizer module are special, as they are what is considered §Bthe Split§6. As the name suggests, only one path out of the three may be chosen at first, and the others will be locked. Each path has specialized buffs that are primarily targeted towards a specific module, and thus affect other module types with reduced effect (unless stated otherwise). The amount of unlockable paths depends on the amount of rings the Godforge has, which in turn are limited by later upgrades. gt.blockmachines.multimachine.FOG.milestoneinfotext=Milestones are essential for upgrading the Godforge, as they are the source of graviton shards, the main currency needed for unlocking upgrades. In essence, milestones are just what their name suggests, thresholds that when reached, grant graviton shards. There are four types of milestones, Charge, Conversion, Catalyst and Composition, each referring to a stat of the Godforge. Each milestone has 7 tiers, each being harder to reach than the last, but also granting more graviton shards. The first tier grants 1 graviton shard, the second 2, etc. The §BCharge§6 milestone scales off total power consumption of all modules combined, the first tier being unlocked at 1e15 EU consumed, and each subsequent milestone scaling by 9x. The §BConversion§6 milestone scales off total recipes processed across all modules (excluding the Helioflare Power Forge's furnace mode) and its first tier is unlocked at 10M processed recipes. Following tiers scale by 6x. The §BCatalyst§6 milestone is based on the Forge's fuel consumption, counted in Stellar Fuel units (the number entered in the fuel config menu). Reaching the first tier requires 10,000 fuel units to be consumed, and each tier above scales by 3x. Last but not least, the §BComposition§6 milestone works a bit differently, as it scales off the Forge's structure. Milestone levels are granted for each unique type of module present in the structure (Helifusion Exoticizer modules on quark-gluon and magmatter mode count as unique) and for each additional ring built. Your research suggests that something strange might happen if all milestones reach their final tier... Make sure to check back! +gt.blockmachines.multimachine.FOG.contributors=Contributors +gt.blockmachines.multimachine.FOG.lead=Project Lead +gt.blockmachines.multimachine.FOG.cloud=GDCloud +gt.blockmachines.multimachine.FOG.programming=Programming +gt.blockmachines.multimachine.FOG.teg=TheEpicGamer +gt.blockmachines.multimachine.FOG.serenybiss=§dSereni§5byss +gt.blockmachines.multimachine.FOG.textures=Textures & Structure +gt.blockmachines.multimachine.FOG.ant=Ant +gt.blockmachines.multimachine.FOG.lore=Loremaster +gt.blockmachines.multimachine.FOG.deleno=Deleno +gt.blockmachines.multimachine.FOG.rendering=Rendering Wizard +gt.blockmachines.multimachine.FOG.bucket=BucketBrigade +gt.blockmachines.multimachine.FOG.playtesting=Playtesting +gt.blockmachines.multimachine.FOG.misi=Misi +gt.blockmachines.multimachine.FOG.thanks=A huge thank you to these incredible people for helping to make this a reality! -Cloud gt.blockmachines.multimachine.FOG.hint.0=1 - Classic Hatches or Transcendentally Amplified Magnetic Confinement Casing gt.blockmachines.multimachine.FOG.hint.1=2 - Module Controllers or Singularity Reinforced Stellar Shielding Casing @@ -1248,6 +1270,7 @@ gt.recipe.eyeofharmony=Eye of Harmony gt.recipe.researchStation=Research Station gt.recipe.fog_plasma=Heliothermal Plasma Fabricator gt.recipe.fog_exotic=Heliofusion Exoticizer +gt.recipe.fog_molten=Helioflux Melting Core # NEI diff --git a/src/main/resources/assets/tectech/shaders/fadebypass.frag.glsl b/src/main/resources/assets/tectech/shaders/fadebypass.frag.glsl new file mode 100644 index 00000000000..5102d76abb4 --- /dev/null +++ b/src/main/resources/assets/tectech/shaders/fadebypass.frag.glsl @@ -0,0 +1,7 @@ +#version 120 +uniform sampler2D u_Texture; +varying vec2 v_TexCoord; + +void main() { + gl_FragColor = texture2D(u_Texture, v_TexCoord); +} diff --git a/src/main/resources/assets/tectech/shaders/fadebypass.vert.glsl b/src/main/resources/assets/tectech/shaders/fadebypass.vert.glsl new file mode 100644 index 00000000000..294497100ad --- /dev/null +++ b/src/main/resources/assets/tectech/shaders/fadebypass.vert.glsl @@ -0,0 +1,7 @@ +#version 120 +varying vec2 v_TexCoord; + +void main() { + v_TexCoord = gl_MultiTexCoord0.xy; + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; +} diff --git a/src/main/resources/assets/tectech/shaders/gorgeBeam.frag.glsl b/src/main/resources/assets/tectech/shaders/gorgeBeam.frag.glsl new file mode 100644 index 00000000000..1ee45d3764d --- /dev/null +++ b/src/main/resources/assets/tectech/shaders/gorgeBeam.frag.glsl @@ -0,0 +1,28 @@ +#version 120 + +uniform float u_Intensity; +uniform vec3 u_CameraPosition; +uniform sampler2D u_Texture; +uniform vec3 u_Color; + + +varying vec2 v_TexCoord; +varying vec2 v_localPosition; +varying float v_Transparency; + +float luminanceTransform(vec3 color){ + return 0.2126*color.r+0.7152*color.g+0.0722*color.b; + //return (color.r+color.g+color.b)/3.0; +} + + +void main() { + float v_effect = dot(normalize(u_CameraPosition.xy),normalize(v_localPosition)); + float transparency = (v_effect-.5)*2; + transparency = pow(transparency,u_Intensity); + + vec4 texColor = texture2D(u_Texture,v_TexCoord); + float luminance = 1-luminanceTransform(texColor.xyz); + luminance = mix(luminance,1,1-pow(transparency,6)); + gl_FragColor = vec4(u_Color,transparency*v_Transparency*luminance); +} diff --git a/src/main/resources/assets/tectech/shaders/gorgeBeam.vert.glsl b/src/main/resources/assets/tectech/shaders/gorgeBeam.vert.glsl new file mode 100644 index 00000000000..696d4d0df76 --- /dev/null +++ b/src/main/resources/assets/tectech/shaders/gorgeBeam.vert.glsl @@ -0,0 +1,77 @@ +#version 120 + +attribute float a_VertexID; + + +uniform float u_SegmentQuads; +uniform float u_Time; + +//X = radius +//Y = z offset +//Z = transparency +uniform vec3 u_SegmentArray[11]; +uniform vec3 u_CameraPosition; +uniform mat4 u_ModelMatrix; + + + +varying vec2 v_TexCoord; +varying vec2 v_localPosition; +varying float v_Transparency; + + +const float PI = 3.1415926535897; + +float getAngle(int quadID, int localID){ + int id_offset = (localID > 1 && localID < 5)? 0:1; + return ((PI)*(quadID+id_offset))/u_SegmentQuads; +} + +void main() { + + int id = int(a_VertexID); + int segments = (u_SegmentArray.length()-1); + int quads = int(u_SegmentQuads); + + int localID = int(mod(a_VertexID,6.0)); //Local id of the vertex within a face + int quadID = int(mod(float(id/6),quads)); //Local id of a quad within a segment + int segmentID = int(id/(quads*6)); + segmentID = int(min(float(segmentID),float(segments-1))); + + float radius0 = u_SegmentArray[segmentID].x; + float radius1 = u_SegmentArray[segmentID+1].x; + + float offset0 = u_SegmentArray[segmentID].y; + float offset1 = u_SegmentArray[segmentID+1].y; + + float trans0 = u_SegmentArray[segmentID].z; + float trans1 = u_SegmentArray[segmentID+1].z; + + float slope = (radius1-radius0)/(offset1-offset0); + + + float cameraAngle = atan(u_CameraPosition.y,u_CameraPosition.x); + float staticAngle = getAngle(quadID,localID); + + + float angle = staticAngle+(cameraAngle-PI/2); + + float offset = (localID > 0 && localID < 4)?offset0:offset1; + float radius = (localID > 0 && localID < 4)?radius0:radius1; + v_Transparency = (localID > 0 && localID < 4)?trans0:trans1; + + //radius = min(radius,length(u_CameraPosition.xy)); + + vec3 localPosition = vec3(cos(angle)*radius,sin(angle)*radius,offset); + vec4 worldPosition = u_ModelMatrix*vec4(localPosition,1); + + gl_Position = gl_ModelViewProjectionMatrix * worldPosition; + + v_localPosition = localPosition.xy; + + float timer = u_Time/240; + + float heightOffset = (offset/256) + timer; + v_TexCoord = vec2(heightOffset,angle/(2*PI)+heightOffset/3 + timer); +} + diff --git a/src/main/resources/assets/tectech/shaders/star.frag.glsl b/src/main/resources/assets/tectech/shaders/star.frag.glsl new file mode 100644 index 00000000000..d5a6ff894e7 --- /dev/null +++ b/src/main/resources/assets/tectech/shaders/star.frag.glsl @@ -0,0 +1,30 @@ +uniform sampler2D u_Texture; +uniform vec4 u_Color; +uniform float u_Gamma; + +varying vec2 v_TexCoord; + +vec3 toYIQ(vec3 rgb){ + return mat3( 0.299, 1.0, 0.40462981, 0.587, -0.46081557, -1.0, 0.114, -0.53918443, 0.59537019 ) * rgb; +} + +vec3 toRGB(vec3 yiq){ + return mat3( 1.0, 1.0, 1.0, 0.5696804, -0.1620848, -0.6590654, 0.3235513, -0.3381869, 0.8901581 ) * yiq; +} + +void main() { + vec3 texture = texture2D(u_Texture, v_TexCoord).rgb; + + vec3 original = toYIQ(texture); + + if (length(original.xy) < .01){ + gl_FragColor = vec4(texture,1); + } else { + vec3 targetYIQ = toYIQ(u_Color.rgb); + vec3 originalYIQ = toYIQ(texture); + vec3 yiqColor = vec3(original.x,targetYIQ.yz); + vec3 finalrgb = toRGB(yiqColor); + finalrgb = pow(finalrgb,vec3(1/u_Gamma)); + gl_FragColor = vec4(finalrgb,u_Color.a); + } +} diff --git a/src/main/resources/assets/tectech/shaders/star.vert.glsl b/src/main/resources/assets/tectech/shaders/star.vert.glsl new file mode 100644 index 00000000000..7dab1d35003 --- /dev/null +++ b/src/main/resources/assets/tectech/shaders/star.vert.glsl @@ -0,0 +1,10 @@ +#version 120 + + +uniform mat4 u_ModelMatrix; +varying vec2 v_TexCoord; + +void main() { + v_TexCoord = gl_MultiTexCoord0.xy; + gl_Position = gl_ModelViewProjectionMatrix * u_ModelMatrix * gl_Vertex; +} diff --git a/src/main/resources/assets/tectech/textures/gui/background/rainbow_glow.png b/src/main/resources/assets/tectech/textures/gui/background/rainbow_glow.png new file mode 100644 index 00000000000..467967ea176 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/background/rainbow_glow.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/button/purple.png b/src/main/resources/assets/tectech/textures/gui/button/purple.png index 60af6ebc6f4..28f2835c992 100644 Binary files a/src/main/resources/assets/tectech/textures/gui/button/purple.png and b/src/main/resources/assets/tectech/textures/gui/button/purple.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/button/purple_pressed.png b/src/main/resources/assets/tectech/textures/gui/button/purple_pressed.png index 88339c7576f..92a11ff2e22 100644 Binary files a/src/main/resources/assets/tectech/textures/gui/button/purple_pressed.png and b/src/main/resources/assets/tectech/textures/gui/button/purple_pressed.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/overlay_button/heart.png b/src/main/resources/assets/tectech/textures/gui/overlay_button/heart.png new file mode 100644 index 00000000000..96cff19d893 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/overlay_button/heart.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector.png b/src/main/resources/assets/tectech/textures/gui/picture/connector.png deleted file mode 100644 index c333d0ded82..00000000000 Binary files a/src/main/resources/assets/tectech/textures/gui/picture/connector.png and /dev/null differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_blue.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_blue.png new file mode 100644 index 00000000000..9eeb1e78e1e Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_blue.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_blue_opaque.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_blue_opaque.png new file mode 100644 index 00000000000..8288c9cac36 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_blue_opaque.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_empty.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_empty.png deleted file mode 100644 index c043180b5c5..00000000000 Binary files a/src/main/resources/assets/tectech/textures/gui/picture/connector_empty.png and /dev/null differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_green.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_green.png new file mode 100644 index 00000000000..f6b21a84632 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_green.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_green_opaque.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_green_opaque.png new file mode 100644 index 00000000000..f6e46b25617 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_green_opaque.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_orange.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_orange.png new file mode 100644 index 00000000000..8ceed719cf4 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_orange.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_orange_opaque.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_orange_opaque.png new file mode 100644 index 00000000000..0a6a5a5d282 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_orange_opaque.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_purple.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_purple.png new file mode 100644 index 00000000000..3eada4cd52a Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_purple.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_purple_opaque.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_purple_opaque.png new file mode 100644 index 00000000000..dd90244d8a3 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_purple_opaque.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_red.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_red.png new file mode 100644 index 00000000000..edd307fa7e9 Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_red.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_red_opaque.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_red_opaque.png new file mode 100644 index 00000000000..9631fdb40be Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/connector_red_opaque.png differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/connector_switch.png b/src/main/resources/assets/tectech/textures/gui/picture/connector_switch.png deleted file mode 100644 index f72c959a526..00000000000 Binary files a/src/main/resources/assets/tectech/textures/gui/picture/connector_switch.png and /dev/null differ diff --git a/src/main/resources/assets/tectech/textures/gui/picture/thanks.png b/src/main/resources/assets/tectech/textures/gui/picture/thanks.png new file mode 100644 index 00000000000..7a83301f87b Binary files /dev/null and b/src/main/resources/assets/tectech/textures/gui/picture/thanks.png differ