diff options
| author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-01-10 15:37:08 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-10 15:37:08 +0000 |
| commit | be99d41cc25bc1a84cf72dcb15c2841f6e88adbd (patch) | |
| tree | 5a98e6baced49d86abbec49140e88d6b3200574d /src/main/java | |
| parent | 44fbc83f2e41def4a911eca26af0ee76a1b99962 (diff) | |
| parent | b2a2166e2c9086b0e5678d9088522437fe6af607 (diff) | |
| download | GT5-Unofficial-be99d41cc25bc1a84cf72dcb15c2841f6e88adbd.tar.gz GT5-Unofficial-be99d41cc25bc1a84cf72dcb15c2841f6e88adbd.tar.bz2 GT5-Unofficial-be99d41cc25bc1a84cf72dcb15c2841f6e88adbd.zip | |
Merge b2a2166e2c9086b0e5678d9088522437fe6af607 into 44fbc83f2e41def4a911eca26af0ee76a1b99962
Diffstat (limited to 'src/main/java')
46 files changed, 4081 insertions, 2775 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index 6640949617..cd51a532d3 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -19,7 +19,9 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.commands.EMList import com.github.technus.tectech.mechanics.elementalMatter.core.definitions.registry.EMDefinitionsRegistry; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.EMTransformationRegistry; import com.github.technus.tectech.mechanics.enderStorage.EnderWorldSavedData; +import com.github.technus.tectech.nei.IMCForNEI; import com.github.technus.tectech.proxy.CommonProxy; +import com.github.technus.tectech.recipe.EyeOfHarmonyRecipeStorage; import com.github.technus.tectech.util.XSTR; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; @@ -209,6 +211,7 @@ public class TecTech { MainLoader.load(definitionsRegistry); MainLoader.addAfterGregTechPostLoadRunner(); + IMCForNEI.IMCSender(); } @Mod.EventHandler @@ -231,9 +234,14 @@ public class TecTech { } } + public static EyeOfHarmonyRecipeStorage eyeOfHarmonyRecipeStorage = null; + @Mod.EventHandler public void onServerAboutToStart(FMLServerAboutToStartEvent aEvent) { chunkDataHandler.clearData(); playerPersistence.clearData(); + + // This must be done after game load otherwise it fails. + eyeOfHarmonyRecipeStorage = new EyeOfHarmonyRecipeStorage(); } } diff --git a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java index f69941cb63..c27fd95bd3 100644 --- a/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java +++ b/src/main/java/com/github/technus/tectech/loader/TecTechConfig.java @@ -46,6 +46,7 @@ public class TecTechConfig extends ConfigManager { */ @Override protected void PreInit() { + DISABLE_MATERIAL_LOADING_FFS = false; BOOM_ENABLE = true; diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 436c806da2..89230fa4e1 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -844,8 +844,8 @@ public class MachineLoader implements Runnable { Machine_Multi_Annihilation.set( new GT_MetaTileEntity_EM_annihilation(15405, "multimachine.em.annihilation", "Annihilation Generator") .getStackForm(1L)); - Machine_Multi_BHG.set( - new GT_MetaTileEntity_EM_bhg(15410, "multimachine.em.blackholegenerator", "Black Hole Generator") + Machine_Multi_EyeOfHarmony.set( + new GT_MetaTileEntity_EM_EyeOfHarmony(15410, "multimachine.em.eye_of_harmony", "Eye of Harmony") .getStackForm(1L)); // =================================================================================================== diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java index bf02479fc2..53389d6fa5 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.loader.thing; +import static com.github.technus.tectech.Reference.MODID; import static com.github.technus.tectech.TecTech.tectechTexturePage1; import com.github.technus.tectech.Reference; @@ -9,12 +10,11 @@ import com.github.technus.tectech.compatibility.openmodularturrets.blocks.turret import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.block.ReactorSimBlock; -import com.github.technus.tectech.thing.casing.GT_Block_CasingsBA0; -import com.github.technus.tectech.thing.casing.GT_Block_CasingsNH; -import com.github.technus.tectech.thing.casing.GT_Block_CasingsTT; -import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.block.TileEyeOfHarmony; +import com.github.technus.tectech.thing.casing.*; import com.github.technus.tectech.thing.item.*; import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -24,6 +24,9 @@ import gregtech.api.interfaces.ITexture; public class ThingsLoader implements Runnable { @Override public void run() { + + GameRegistry.registerTileEntity(TileEyeOfHarmony.class, MODID + ":EyeOfHarmonyRenderBlock"); + if (Textures.BlockIcons.casingTexturePages[tectechTexturePage1] == null) { Textures.BlockIcons.casingTexturePages[tectechTexturePage1] = new ITexture[128]; } @@ -37,6 +40,15 @@ public class ThingsLoader implements Runnable { TT_Container_Casings.sBlockCasingsBA0 = new GT_Block_CasingsBA0(); TecTech.LOGGER.info("Nikolai's Casing registered"); + TT_Block_SpacetimeCompressionFieldGenerators.SpacetimeCompressionFieldGenerators = + new SpacetimeCompressionFieldCasing(); + TecTech.LOGGER.info("Spacetime Compression Field Casings registered."); + + TT_Block_TimeAccelerationFieldGenerators.TimeAccelerationFieldGenerator = new TimeAccelerationFieldCasing(); + TecTech.LOGGER.info("Time Acceleration Field Casings registered."); + + TT_Block_StabilisationFieldGenerators.StabilisationFieldGenerators = new StabilisationFieldCasing(); + QuantumGlassBlock.run(); TecTech.LOGGER.info("Quantum Glass registered"); diff --git a/src/main/java/com/github/technus/tectech/nei/IMCForNEI.java b/src/main/java/com/github/technus/tectech/nei/IMCForNEI.java new file mode 100644 index 0000000000..b36b15b619 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/nei/IMCForNEI.java @@ -0,0 +1,49 @@ +package com.github.technus.tectech.nei; + +import com.github.technus.tectech.TecTech; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.event.FMLInterModComms; +import net.minecraft.nbt.NBTTagCompound; + +import static com.github.technus.tectech.Reference.MODID; + +public class IMCForNEI { + + public static void IMCSender() { + if (!Loader.isModLoaded("NotEnoughItems")) { + return; + } + sendHandler("gt.recipe.eyeofharmony", "gregtech:gt.blockmachines:15410", 1); + sendCatalyst("gt.recipe.eyeofharmony", "gregtech:gt.blockmachines:15410"); + } + + private static void sendHandler(String aName, String aBlock, int aMaxRecipesPerPage) { + NBTTagCompound aNBT = new NBTTagCompound(); + aNBT.setString("handler", aName); + aNBT.setString("modName", MODID); + aNBT.setString("modId", MODID); + aNBT.setBoolean("modRequired", true); + aNBT.setString("itemName", aBlock); + aNBT.setInteger("handlerHeight", 135); + aNBT.setInteger("handlerWidth", 166); + aNBT.setInteger("maxRecipesPerPage", aMaxRecipesPerPage); + aNBT.setInteger("yShift", 6); + FMLInterModComms.sendMessage("NotEnoughItems", "registerHandlerInfo", aNBT); + } + + private static void sendHandler(String aName, String aBlock) { + sendHandler(aName, aBlock, 2); + } + + private static void sendCatalyst(String aName, String aStack, int aPriority) { + NBTTagCompound aNBT = new NBTTagCompound(); + aNBT.setString("handlerID", aName); + aNBT.setString("itemName", aStack); + aNBT.setInteger("priority", aPriority); + FMLInterModComms.sendMessage("NotEnoughItems", "registerCatalystInfo", aNBT); + } + + private static void sendCatalyst(String aName, String aStack) { + sendCatalyst(aName, aStack, 0); + } +} diff --git a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java index 1871f87875..ffb72638c7 100644 --- a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java +++ b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java @@ -8,6 +8,7 @@ public class NEI_TT_Config implements IConfigureNEI { // must be NEI*Config public static boolean sIsAdded = true; public static TT_NEI_ResearchHandler TT_RH; public static TT_NEI_ScannerHandler TT_SH; + public static TT_NEI_EyeOfHarmonyHandler TT_EOH; @Override public void loadConfig() { @@ -15,6 +16,7 @@ public class NEI_TT_Config implements IConfigureNEI { // must be NEI*Config if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { TT_RH = new TT_NEI_ResearchHandler(TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes); TT_SH = new TT_NEI_ScannerHandler(TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes); + TT_EOH = new TT_NEI_EyeOfHarmonyHandler(TT_recipe.GT_Recipe_MapTT.sEyeofHarmonyRecipes); } sIsAdded = true; } diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java new file mode 100644 index 0000000000..fd964c90c4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_EyeOfHarmonyHandler.java @@ -0,0 +1,34 @@ +package com.github.technus.tectech.nei; + +import static com.github.technus.tectech.Reference.MODID; +import static net.minecraft.util.EnumChatFormatting.*; + +import codechicken.nei.recipe.GuiCraftingRecipe; +import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; +import cpw.mods.fml.common.event.FMLInterModComms; +import gregtech.api.enums.GT_Values; +import gregtech.api.util.GT_Recipe; +import gregtech.nei.GT_NEI_DefaultHandler; + +public class TT_NEI_EyeOfHarmonyHandler extends GT_NEI_DefaultHandler { + + public TT_NEI_EyeOfHarmonyHandler(final GT_Recipe.GT_Recipe_Map tMap) { + super(tMap); + if (!NEI_TT_Config.sIsAdded) { + + FMLInterModComms.sendRuntimeMessage( + GT_Values.GT, + "NEIPlugins", + "register-crafting-handler", + MODID + "@" + this.getRecipeName() + "@" + this.getOverlayIdentifier()); + GuiCraftingRecipe.craftinghandlers.add(this); + GuiUsageRecipe.usagehandlers.add(this); + } + } + + @Override + public TemplateRecipeHandler newInstance() { + return new TT_NEI_EyeOfHarmonyHandler(this.mRecipeMap); + } +} diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 17451919b8..e6b2d0930c 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -4,15 +4,13 @@ import static com.github.technus.tectech.TecTech.RANDOM; import com.github.technus.tectech.Reference; import com.github.technus.tectech.compatibility.openmodularturrets.TT_turret_loader; -import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.thing.block.QuantumGlassRender; -import com.github.technus.tectech.thing.block.QuantumStuffBlock; -import com.github.technus.tectech.thing.block.QuantumStuffRender; +import com.github.technus.tectech.thing.block.*; import com.github.technus.tectech.thing.item.DebugElementalInstanceContainer_EM; import com.github.technus.tectech.thing.item.ElementalDefinitionContainer_EM; import com.github.technus.tectech.thing.item.renderElemental.RenderElementalName; import com.gtnewhorizon.structurelib.entity.fx.WeightlessParticleFX; import cpw.mods.fml.client.FMLClientHandler; +import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Loader; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -33,19 +31,16 @@ public class ClientProxy extends CommonProxy { QuantumGlassBlock.renderID = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(QuantumGlassBlock.renderID, new QuantumGlassRender()); - QuantumStuffBlock.renderID = RenderingRegistry.getNextAvailableRenderId(); - RenderingRegistry.registerBlockHandler(QuantumStuffBlock.renderID, new QuantumStuffRender()); - MinecraftForgeClient.registerItemRenderer( ElementalDefinitionContainer_EM.INSTANCE, RenderElementalName.INSTANCE); MinecraftForgeClient.registerItemRenderer( DebugElementalInstanceContainer_EM.INSTANCE, RenderElementalName.INSTANCE); - // MinecraftForgeClient.registerItemRenderer(ElementalDefinitionScanStorage_EM.INSTANCE, - // RenderElementalName.INSTANCE); if (Loader.isModLoaded("openmodularturrets")) { new TT_turret_loader().run(); } + + ClientRegistry.bindTileEntitySpecialRenderer(TileEyeOfHarmony.class, new RenderEyeOfHarmony()); } @Override diff --git a/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java new file mode 100644 index 0000000000..807663c9bb --- /dev/null +++ b/src/main/java/com/github/technus/tectech/recipe/EyeOfHarmonyRecipe.java @@ -0,0 +1,360 @@ +package com.github.technus.tectech.recipe; + +import static com.github.technus.tectech.recipe.EyeOfHarmonyRecipeStorage.BILLION; +import static com.google.common.math.IntMath.pow; +import static gregtech.api.GregTech_API.getUnificatedOreDictStack; +import static gregtech.api.util.GT_Utility.getPlasmaFuelValueInEUPerLiterFromMaterial; +import static java.lang.Math.min; + +import com.github.technus.tectech.util.ItemStackLong; +import gnu.trove.map.TMap; +import gnu.trove.map.hash.TCustomHashMap; +import gnu.trove.strategy.HashingStrategy; +import gregtech.api.enums.Materials; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.tuple.Pair; +import pers.gwyog.gtneioreplugin.util.GT5OreLayerHelper; +import pers.gwyog.gtneioreplugin.util.GT5OreSmallHelper; + +@SuppressWarnings("SpellCheckingInspection") +public class EyeOfHarmonyRecipe { + + HashingStrategy<ItemStack> itemStackHashingStrategy = new HashingStrategy<ItemStack>() { + @Override + public int computeHashCode(ItemStack stack) { + // Not really sure how this works or if it is "unique enough". + int result = stack.getItem().hashCode(); + result = 31 * result + stack.getItemDamage(); + return result; + } + + @Override + public boolean equals(ItemStack item1, ItemStack item2) { + return item1.getUnlocalizedName().equals(item2.getUnlocalizedName()); + } + }; + + private final TMap<ItemStack, Double> itemStackToProbabilityMap = new TCustomHashMap<>(itemStackHashingStrategy); + private final TMap<ItemStack, Long> itemStackToTrueStackSizeMap = new TCustomHashMap<>(itemStackHashingStrategy); + + private final ArrayList<ItemStackLong> outputItems; + private final ArrayList<FluidStack> outputFluids; + + private final long hydrogenRequirement; + private final long heliumRequirement; + + private final long euOutput; + private final long euStartCost; + + private final double baseSuccessChance; + + private final long spacetimeCasingTierRequired; + + private final long miningTimeSeconds; + + private final double recipeEnergyEfficiency; + + private final ItemStack recipeTriggerItem; + + private final long sumOfItems; + private final long rocketTier; + + public TMap<ItemStack, Double> getItemStackToProbabilityMap() { + return itemStackToProbabilityMap; + } + + public TMap<ItemStack, Long> getItemStackToTrueStackSizeMap() { + return itemStackToTrueStackSizeMap; + } + + public double getRecipeEnergyEfficiency() { + return recipeEnergyEfficiency; + } + + @SuppressWarnings("FieldCanBeLocal") + private final long standardRecipeEUOutPerTick = 100 * BILLION; + + public long getSumOfItems() { + return sumOfItems; + } + + public long getRocketTier() { + return rocketTier; + } + + public EyeOfHarmonyRecipe( + ArrayList<Pair<Materials, Long>> materialList, + Block block, + final double recipeEnergyEfficiency, + final long hydrogenRequirement, + final long heliumRequirement, + final long miningTimeSeconds, + final long rocketTierOfRecipe, + final double baseSuccessChance) { + + this.rocketTier = rocketTierOfRecipe; + this.spacetimeCasingTierRequired = min(8, rocketTierOfRecipe); + + this.recipeTriggerItem = new ItemStack(block); + + this.outputItems = validDustGenerator(materialList); + this.outputItems.sort(Comparator.comparingLong(ItemStackLong::getStackSize)); + Collections.reverse(this.outputItems); + + this.sumOfItems = + this.outputItems.stream().map(ItemStackLong::getStackSize).reduce(0L, Long::sum); + + for (ItemStackLong itemStackLong : outputItems) { + double stackSize = (double) itemStackLong.getStackSize(); + double probability = Math.round(100_000 * stackSize / sumOfItems) / 1000.0; + + itemStackToProbabilityMap.put(itemStackLong.itemStack, probability); + itemStackToTrueStackSizeMap.put(itemStackLong.itemStack, itemStackLong.stackSize); + } + // End item processing. + + // --- Output and process fluids of the recipe. + ArrayList<FluidStack> fluidStackArrayList = validPlasmaGenerator(materialList); + + for (FluidStack fluidStack : fluidStackArrayList) { + fluidStack.amount = (int) ((this.spacetimeCasingTierRequired + 1) * 1_000_000L); + } + + // Add a bonus fluid of compressed star matter. + // todo replace with Bonus star matter when added to GT5. + fluidStackArrayList.add(Materials.Infinity.getMolten((this.spacetimeCasingTierRequired + 1) * 100_000)); + + outputFluids = fluidStackArrayList; + // End fluid processing. + + this.hydrogenRequirement = hydrogenRequirement; + this.heliumRequirement = heliumRequirement; + + this.baseSuccessChance = baseSuccessChance; + + this.miningTimeSeconds = miningTimeSeconds; + this.recipeEnergyEfficiency = recipeEnergyEfficiency; + + long plasmaEU = plasmaCostCalculator(outputFluids); + long VM3EU = miningTimeSeconds * pow(2, 19) * 20; + this.euStartCost = (plasmaEU + VM3EU + standardRecipeEUOutPerTick * 20 * miningTimeSeconds); + this.euOutput = (long) (euStartCost * recipeEnergyEfficiency); + } + + public EyeOfHarmonyRecipe( + final GT5OreLayerHelper.NormalOreDimensionWrapper normalOreDimensionWrapper, + final GT5OreSmallHelper.SmallOreDimensionWrapper smallOreDimensionWrapper, + final Block block, + final double recipeEnergyEfficiency, + final long hydrogenRequirement, + final long heliumRequirement, + final long miningTimeSeconds, + final long spacetimeCasingTierRequired, + final double baseSuccessChance) { + + // Process recipes output items. + // 6 * 64 = 6 stacks/second for VM tier 3 + Og gas. + this( + processDimension(normalOreDimensionWrapper, smallOreDimensionWrapper, miningTimeSeconds), + block, + recipeEnergyEfficiency, + hydrogenRequirement, + heliumRequirement, + miningTimeSeconds, + spacetimeCasingTierRequired, + baseSuccessChance); + } + + // Return clone of list. Deep copy. Maybe a better way to do this? + public ArrayList<ItemStackLong> getOutputItems() { + ArrayList<ItemStackLong> copyOutputList = new ArrayList<>(); + for (ItemStackLong itemStackLong : outputItems) { + copyOutputList.add(new ItemStackLong(itemStackLong)); + } + + return copyOutputList; + } + + // Deep copy. + public FluidStack[] getOutputFluids() { + ArrayList<FluidStack> copyOutputList = new ArrayList<>(); + + for (FluidStack fluidStack : outputFluids) { + copyOutputList.add(fluidStack.copy()); + } + + return copyOutputList.toArray(new FluidStack[0 |
