diff options
| author | Maya <10861407+serenibyss@users.noreply.github.com> | 2024-11-28 12:01:03 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-28 19:01:03 +0100 |
| commit | e41a0889c5f498252691180b143c97b570b2fc6b (patch) | |
| tree | 60e1dd7a5a1fa4e7e081f6fccdb438897fa49c20 /src/main/java/tectech/thing/metaTileEntity/multi/godforge | |
| parent | 3fcd89ab979db773d63c498de905558d32943420 (diff) | |
| download | GT5-Unofficial-e41a0889c5f498252691180b143c97b570b2fc6b.tar.gz GT5-Unofficial-e41a0889c5f498252691180b143c97b570b2fc6b.tar.bz2 GT5-Unofficial-e41a0889c5f498252691180b143c97b570b2fc6b.zip | |
Godforge hangover (#3396)
Co-authored-by: GDCloud <gdcloudstrike@gmail.com>
Co-authored-by: GDCloud <93287602+GDCloudstrike@users.noreply.github.com>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/tectech/thing/metaTileEntity/multi/godforge')
16 files changed, 2551 insertions, 1645 deletions
diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEBaseModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEBaseModule.java index 8b432d2ce8..85cc5b11b5 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEBaseModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEBaseModule.java @@ -57,6 +57,7 @@ import gregtech.api.util.GTStructureUtility; import tectech.TecTech; import tectech.thing.gui.TecTechUITextures; import tectech.thing.metaTileEntity.multi.base.TTMultiblockBase; +import tectech.thing.metaTileEntity.multi.godforge.util.ForgeOfGodsUI; public class MTEBaseModule extends TTMultiblockBase { diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEExoticModule.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEExoticModule.java index d30f9402d9..e14a40f863 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEExoticModule.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEExoticModule.java @@ -1,5 +1,6 @@ package tectech.thing.metaTileEntity.multi.godforge; +import static gregtech.api.enums.Mods.NewHorizonsCoreMod; import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; import static gregtech.api.util.GTRecipeBuilder.INGOTS; import static gregtech.api.util.GTRecipeBuilder.SECONDS; @@ -22,8 +23,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Stream; -import javax.annotation.Nonnull; - import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -42,6 +41,8 @@ import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; import com.gtnewhorizons.modularui.api.fluids.FluidTanksHandler; import com.gtnewhorizons.modularui.api.fluids.IFluidTanksHandler; +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.Pos2d; import com.gtnewhorizons.modularui.api.math.Size; @@ -53,6 +54,7 @@ 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.SlotWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; import gregtech.api.enums.MaterialsUEVplus; @@ -69,13 +71,15 @@ import gregtech.api.recipe.check.SimpleCheckRecipeResult; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTRecipe; import gregtech.api.util.GTStreamUtil; +import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; import tectech.TecTech; import tectech.recipe.TecTechRecipeMaps; import tectech.thing.CustomItemList; import tectech.thing.gui.TecTechUITextures; -import tectech.util.GodforgeMath; +import tectech.thing.metaTileEntity.multi.godforge.util.ForgeOfGodsUI; +import tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath; public class MTEExoticModule extends MTEBaseModule { @@ -93,6 +97,7 @@ public class MTEExoticModule extends MTEBaseModule { private BigInteger powerForRecipe = BigInteger.ZERO; private static final int NUMBER_OF_INPUTS = 7; private static final int INPUT_LIST_WINDOW_ID = 11; + private static final int POSSIBLE_INPUTS_WINDOW_ID = 12; public MTEExoticModule(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -126,7 +131,7 @@ public class MTEExoticModule extends MTEBaseModule { @NotNull @Override - protected CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { + protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { if (!recipeInProgress || recipeRegenerated) { powerForRecipe = BigInteger.valueOf(getProcessingVoltage()) .multiply(BigInteger.valueOf(recipe.mDuration * actualParallel)); @@ -155,7 +160,8 @@ public class MTEExoticModule extends MTEBaseModule { } for (FluidStack stack : recipe.mFluidInputs) { - if (!ArrayUtils.contains(inputFluids, stack)) { + if (!ArrayUtils.contains(inputFluids, stack) + || inputFluids[ArrayUtils.indexOf(inputFluids, stack)].amount != stack.amount) { return SimpleCheckRecipeResult.ofFailure("waiting_for_inputs"); } } @@ -164,7 +170,7 @@ public class MTEExoticModule extends MTEBaseModule { @NotNull @Override - protected CheckRecipeResult onRecipeStart(@Nonnull GTRecipe recipe) { + protected CheckRecipeResult onRecipeStart(@NotNull GTRecipe recipe) { EUt = calculatedEut; powerForRecipe = BigInteger.valueOf(EUt) .multiply(BigInteger.valueOf(duration * actualParallel)); @@ -181,9 +187,9 @@ public class MTEExoticModule extends MTEBaseModule { return CheckRecipeResultRegistry.SUCCESSFUL; } - @Nonnull + @NotNull @Override - protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe) { + protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) { return super.createOverclockCalculator(recipe).setEUt(getProcessingVoltage()) .setDurationDecreasePerOC(getOverclockTimeFactor()); } @@ -369,7 +375,7 @@ public class MTEExoticModule extends MTEBaseModule { @Override public boolean supportsBatchMode() { - return false; + return true; } @Override @@ -465,6 +471,7 @@ public class MTEExoticModule extends MTEBaseModule { .setTooltipShowUpDelay(TOOLTIP_DELAY)); super.addUIWidgets(builder, buildContext); buildContext.addSyncedWindow(INPUT_LIST_WINDOW_ID, this::createInputListWindow); + buildContext.addSyncedWindow(POSSIBLE_INPUTS_WINDOW_ID, this::createPossibleInputsWindow); builder.widget(createMagmatterSwitch(builder)); builder.widget(createExpectedInputsButton()); builder.widget( @@ -548,6 +555,10 @@ public class MTEExoticModule extends MTEBaseModule { builder, (widget, val) -> widget.notifyTooltipChange())); + if (NewHorizonsCoreMod.isModLoaded()) { + builder.widget(createPossibleInputsButton()); + } + return builder.build(); } @@ -563,6 +574,155 @@ public class MTEExoticModule extends MTEBaseModule { .setPos(8, 69); } + protected ModularWindow createPossibleInputsWindow(final EntityPlayer player) { + final int WIDTH = 300; + final int HEIGHT = 143; + ModularWindow.Builder builder = ModularWindow.builder(WIDTH, HEIGHT); + builder.setBackground(GTUITextures.BACKGROUND_SINGLEBLOCK_DEFAULT); + builder.setGuiTint(getGUIColorization()); + builder.setDraggable(true); + builder.widget( + ButtonWidget.closeWindowButton(true) + .setPos(284, 4)); + + int QGPItemMapSize = exoticModulePlasmaItemMap.size(); + int QGPFluidMapSize = exoticModulePlasmaFluidMap.size(); + + IItemHandlerModifiable QGPItemHandler = new ItemStackHandler(QGPItemMapSize); + IFluidTanksHandler QGPFluidHandler = new FluidTanksHandler(QGPFluidMapSize, 128000); + + List<Map.Entry<ItemStack, Integer>> itemEntryList = new ArrayList<>(exoticModulePlasmaItemMap.entrySet()); + List<Map.Entry<FluidStack, Integer>> fluidEntryList = new ArrayList<>(exoticModulePlasmaFluidMap.entrySet()); + + int slotYQGP = 0; + + for (int i = 0; i < QGPItemMapSize + QGPFluidMapSize; i++) { + + int slotXQGP = 6 + i % 16 * 18; + slotYQGP = 17 + i / 16 * 18; + + if (i < QGPItemMapSize) { + QGPItemHandler.setStackInSlot( + i, + GTUtility.copyAmount( + 1, + itemEntryList.get(i) + .getKey())); + builder.widget( + new DrawableWidget().setDrawable(GTUITextures.BUTTON_STANDARD_PRESSED) + .setPos(slotXQGP, slotYQGP) + .setSize(18, 18)); + builder.widget( + new SlotWidget(QGPItemHandler, i).setAccess(false, false) + .setRenderStackSize(false) + .disableInteraction() + .setPos(slotXQGP, slotYQGP) + .setSize(18, 18)); + } else { + QGPFluidHandler.setFluidInTank( + i - QGPItemMapSize, + fluidEntryList.get(i - QGPItemMapSize) + .getKey() + .getFluid(), + 1); + builder.widget( + new DrawableWidget().setDrawable(ModularUITextures.FLUID_SLOT) + .setSize(18, 18) + .setPos(slotXQGP, slotYQGP)) + .widget( + new FluidSlotWidget(QGPFluidHandler, i - QGPItemMapSize).setInteraction(false, false) + .setSize(18, 18) + .setPos(slotXQGP, slotYQGP)); + } + } + + int magMatterItemMapSize = exoticModuleMagmatterItemMap.size(); + + IItemHandlerModifiable magMatterItemHandler = new ItemStackHandler(magMatterItemMapSize); + IFluidTanksHandler magMatterFluidHandler = new FluidTanksHandler(2, 128000); + magMatterFluidHandler.setFluidInTank( + 0, + MaterialsUEVplus.Space.getMolten(1) + .getFluid(), + 1); + magMatterFluidHandler.setFluidInTank( + 1, + MaterialsUEVplus.Time.getMolten(1) + .getFluid(), + 1); + + List<Map.Entry<ItemStack, Integer>> magMatteritemEntryList = new ArrayList<>( + exoticModuleMagmatterItemMap.entrySet()); + + int slotXMagmatter; + int slotYMagmatter; + + for (int i = 0; i < magMatterItemMapSize + 2; i++) { + slotXMagmatter = 6 + i % 16 * 18; + slotYMagmatter = slotYQGP + 30 + i / 16 * 18; + + if (i < magMatterItemMapSize) { + magMatterItemHandler.setStackInSlot( + i, + GTUtility.copyAmount( + 1, + magMatteritemEntryList.get(i) + .getKey())); + builder.widget( + new DrawableWidget().setDrawable(GTUITextures.BUTTON_STANDARD_PRESSED) + .setPos(slotXMagmatter, slotYMagmatter) + .setSize(18, 18)); + builder.widget( + new SlotWidget(magMatterItemHandler, i).setAccess(false, false) + .setRenderStackSize(false) + .disableInteraction() + .setPos(slotXMagmatter, slotYMagmatter) + .setSize(18, 18)); + } else { + builder.widget( + new DrawableWidget().setDrawable(ModularUITextures.FLUID_SLOT) + .setSize(18, 18) + .setPos(slotXMagmatter, slotYMagmatter)) + .widget( + new FluidSlotWidget(magMatterFluidHandler, i - magMatterItemMapSize) + .setInteraction(false, false) + .setSize(18, 18) + .setPos(slotXMagmatter, slotYMagmatter)); + } + } + + builder.widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.possibleinputsqgp")) + .setDefaultColor(EnumChatFormatting.BLACK) + .setTextAlignment(Alignment.Center) + .setSize(300, 9) + .setPos(0, 6)); + + builder.widget( + new TextWidget(translateToLocal("gt.blockmachines.multimachine.FOG.possibleinputsmagmatter")) + .setDefaultColor(EnumChatFormatting.BLACK) + .setTextAlignment(Alignment.Center) + .setSize(300, 9) + .setPos(0, slotYQGP + 21)); + + return builder.build(); + } + + private Widget createPossibleInputsButton() { + return new ButtonWidget().setOnClick((clickData, widget) -> { + if (!widget.isClient()) { + widget.getContext() + .openSyncedWindow(POSSIBLE_INPUTS_WINDOW_ID); + } + }) + .setPlayClickSound(true) + .setBackground(ModularUITextures.ICON_INFO) + .addTooltip(translateToLocal("fog.button.possibleexoticinputs.tooltip")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setSize(16, 16) + .setPos(79, 37); + } + protected ButtonWidget createMagmatterSwitch(IWidgetBuilder<?> builder) { Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { if (isMagmatterCapable) { diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java index c7d52215c9..a5f833d830 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/MTEForgeOfGods.java @@ -1,6 +1,9 @@ package tectech.thing.metaTileEntity.multi.godforge; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.enums.HatchElement.InputBus; +import static gregtech.api.enums.HatchElement.InputHatch; +import static gregtech.api.enums.HatchElement.OutputBus; import static gregtech.api.enums.Mods.Avaritia; import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; import static gregtech.api.util.GTModHandler.getModItem; @@ -11,21 +14,20 @@ import static java.lang.Math.floor; import static java.lang.Math.log; import static java.lang.Math.max; import static net.minecraft.util.StatCollector.translateToLocal; -import static tectech.loader.recipe.Godforge.godforgeUpgradeMats; import static tectech.thing.casing.TTCasingsContainer.GodforgeCasings; import static tectech.thing.casing.TTCasingsContainer.forgeOfGodsRenderBlock; -import static tectech.util.GodforgeMath.allowModuleConnection; -import static tectech.util.GodforgeMath.calculateEnergyDiscountForModules; -import static tectech.util.GodforgeMath.calculateFuelConsumption; -import static tectech.util.GodforgeMath.calculateMaxFuelFactor; -import static tectech.util.GodforgeMath.calculateMaxHeatForModules; -import static tectech.util.GodforgeMath.calculateMaxParallelForModules; -import static tectech.util.GodforgeMath.calculateProcessingVoltageForModules; -import static tectech.util.GodforgeMath.calculateSpeedBonusForModules; -import static tectech.util.GodforgeMath.calculateStartupFuelConsumption; -import static tectech.util.GodforgeMath.queryMilestoneStats; -import static tectech.util.GodforgeMath.setMiscModuleParameters; -import static tectech.util.TTUtility.toExponentForm; +import static tectech.thing.metaTileEntity.multi.godforge.upgrade.ForgeOfGodsUpgrade.*; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.allowModuleConnection; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.calculateEnergyDiscountForModules; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.calculateFuelConsumption; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.calculateMaxFuelFactor; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.calculateMaxHeatForModules; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.calculateMaxParallelForModules; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.calculateProcessingVoltageForModules; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.calculateSpeedBonusForModules; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.calculateStartupFuelConsumption; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.queryMilestoneStats; +import static tectech.thing.metaTileEntity.multi.godforge.util.GodforgeMath.setMiscModuleParameters; import java.awt.Desktop; import java.awt.Toolkit; @@ -36,7 +38,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; -import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -46,8 +47,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraftforge.common.util.ForgeDirection; @@ -55,7 +57,6 @@ import net.minecraftforge.fluids.FluidStack; import com.google.common.collect.ImmutableList; import com.google.common.math.LongMath; -import com.google.common.primitives.Booleans; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -65,22 +66,17 @@ import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.drawable.Text; import com.gtnewhorizons.modularui.api.drawable.UITexture; import com.gtnewhorizons.modularui.api.drawable.shapes.Rectangle; -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; -import com.gtnewhorizons.modularui.api.math.MainAxisAlignment; import com.gtnewhorizons.modularui.api.math.Pos2d; import com.gtnewhorizons.modularui.api.math.Size; -import com.gtnewhorizons.modularui.api.screen.ModularUIContext; 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.DynamicPositionedColumn; -import com.gtnewhorizons.modularui.common.widget.DynamicPositionedRow; import com.gtnewhorizons.modularui.common.widget.DynamicTextWidget; import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.FluidNameHolderWidget; @@ -88,7 +84,6 @@ 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; import com.gtnewhorizons.modularui.common.widget.textfield.TextFieldWidget; @@ -109,6 +104,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.MTEHatchInput; import gregtech.api.metatileentity.implementations.MTEHatchInputBus; +import gregtech.api.recipe.RecipeMap; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.HatchElementBuilder; @@ -118,57 +114,80 @@ import gregtech.common.tileentities.machines.MTEHatchInputBusME; import gregtech.common.tileentities.machines.MTEHatchOutputBusME; import tectech.TecTech; import tectech.loader.ConfigHandler; +import tectech.recipe.TecTechRecipeMaps; import tectech.thing.block.BlockGodforgeGlass; import tectech.thing.block.TileEntityForgeOfGods; import tectech.thing.gui.TecTechUITextures; import tectech.thing.metaTileEntity.multi.base.TTMultiblockBase; -import tectech.thing.metaTileEntity.multi.godforge.ForgeOfGodsUI.StarColorRGBM; import tectech.thing.metaTileEntity.multi.godforge.color.ForgeOfGodsStarColor; import tectech.thing.metaTileEntity.multi.godforge.color.StarColorSetting; import tectech.thing.metaTileEntity.multi.godforge.color.StarColorStorage; +import tectech.thing.metaTileEntity.multi.godforge.structure.ForgeOfGodsRingsStructureString; +import tectech.thing.metaTileEntity.multi.godforge.structure.ForgeOfGodsStructureString; +import tectech.thing.metaTileEntity.multi.godforge.upgrade.ForgeOfGodsUpgrade; +import tectech.thing.metaTileEntity.multi.godforge.upgrade.UpgradeStorage; +import tectech.thing.metaTileEntity.multi.godforge.util.ForgeOfGodsUI; +import tectech.thing.metaTileEntity.multi.godforge.util.ForgeOfGodsUI.StarColorRGBM; +import tectech.thing.metaTileEntity.multi.godforge.util.MilestoneFormatter; +import tectech.thing.metaTileEntity.multi.godforge.util.MilestoneIcon; +import tectech.thing.metaTileEntity.multi.godforge.util.UpgradeColor; public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, ISurvivalConstructable { + // Field default values for non-zero value defaults for item NBT checks + private static final int DEFAULT_FUEL_CONSUMPTION_FACTOR = 1; + private static final int DEFAULT_MAX_BATTERY_CHARGE = 100; + private static final int DEFAULT_RING_AMOUNT = 1; + private static final int DEFAULT_ROTATION_SPEED = 5; + private static final int DEFAULT_STAR_SIZE = 20; + private static final String DEFAULT_STAR_COLOR = ForgeOfGodsStarColor.DEFAULT.getName(); + private static final MilestoneFormatter DEFAULT_FORMATTING_MODE = MilestoneFormatter.COMMA; + private static final BigInteger DEFAULT_TOTAL_POWER = BigInteger.ZERO; + private static Textures.BlockIcons.CustomIcon ScreenON; - private int fuelConsumptionFactor = 1; - private int selectedFuelType = 0; - private int internalBattery = 0; - private int maxBatteryCharge = 100; - private int gravitonShardsAvailable = 0; - private int gravitonShardsSpent = 0; - private int ringAmount = 1; - private int stellarFuelAmount = 0; - private int neededStartupFuel = 0; - private long fuelConsumption = 0; - private long totalRecipesProcessed = 0; - private long totalFuelConsumed = 0; - private float totalExtensionsBuilt = 0; - private float powerMilestonePercentage = 0; - private float recipeMilestonePercentage = 0; - private float fuelMilestonePercentage = 0; - private float structureMilestonePercentage = 0; - private float invertedPowerMilestonePercentage = 0; - private float invertedRecipeMilestonePercentage = 0; - private float invertedFuelMilestonePercentage = 0; - private float invertedStructureMilestonePercentage = 0; - private BigInteger totalPowerConsumed = BigInteger.ZERO; - private boolean batteryCharging = false; - private boolean inversion = false; - private boolean gravitonShardEjection = false; - private FormattingMode formattingMode = FormattingMode.NONE; - private boolean isRenderActive = false; - private boolean secretUpgrade = false; + private int fuelConsumptionFactor = DEFAULT_FUEL_CONSUMPTION_FACTOR; + private int selectedFuelType; + private int internalBattery; + private int maxBatteryCharge = DEFAULT_MAX_BATTERY_CHARGE; + private int gravitonShardsAvailable; + private int gravitonShardsSpent; + private int ringAmount = DEFAULT_RING_AMOUNT; + private int stellarFuelAmount; + private int neededStartupFuel; + private long fuelConsumption; + private long totalRecipesProcessed; + private long totalFuelConsumed; + private float totalExtensionsBuilt; + private float powerMilestonePercentage; + private float recipeMilestonePercentage; + private float fuelMilestonePercentage; + private float structureMilestonePercentage; + private float invertedPowerMilestonePercentage; + private float invertedRecipeMilestonePercentage; + private float invertedFuelMilestonePercentage; + private float invertedStructureMilestonePercentage; + private BigInteger totalPowerConsumed = DEFAULT_TOTAL_POWER; + private boolean batteryCharging; + private boolean inversion; + private boolean gravitonShardEjection; + private MilestoneFormatter formattingMode = DEFAULT_FORMATTING_MODE; + private boolean isRenderActive; + private boolean secretUpgrade; + private boolean isRendererDisabled; private final ItemStack[] storedUpgradeWindowItems = new ItemStack[16]; public ArrayList<MTEBaseModule> moduleHatches = new ArrayList<>(); protected ItemStackHandler inputSlotHandler = new ItemStackHandler(16); + private final UpgradeStorage upgrades = new UpgradeStorage(); + private ForgeOfGodsUpgrade currentUpgradeWindow; + // Star cosmetics fields // actual star cosmetics private final StarColorStorage starColors = new StarColorStorage(); - private String selectedStarColor = ForgeOfGodsStarColor.DEFAULT.getName(); - private int rotationSpeed = 5; - private int starSize = 20; + private String selectedStarColor = DEFAULT_STAR_COLOR; + private int rotationSpeed = DEFAULT_ROTATION_SPEED; + private int starSize = DEFAULT_STAR_SIZE; // editing star color private ForgeOfGodsStarColor newStarColor = starColors.newTemplateColor(); private int starColorR, starColorG, starColorB; @@ -189,9 +208,8 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, private static final int STAR_COSMETICS_WINDOW_ID = 18; private static final int STAR_CUSTOM_COLOR_WINDOW_ID = 19; private static final int STAR_CUSTOM_COLOR_IMPORT_WINDOW_ID = 20; + private static final int STATISTICS_WINDOW_ID = 21; 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 }; private static final long POWER_MILESTONE_CONSTANT = LongMath.pow(10, 15); private static final long RECIPE_MILESTONE_CONSTANT = LongMath.pow(10, 7); private static final long FUEL_MILESTONE_CONSTANT = 10_000; @@ -307,7 +325,13 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, .addShape(STRUCTURE_PIECE_SECOND_RING_AIR, ForgeOfGodsRingsStructureString.SECOND_RING_AIR) .addShape(STRUCTURE_PIECE_THIRD_RING, ForgeOfGodsRingsStructureString.THIRD_RING) .addShape(STRUCTURE_PIECE_THIRD_RING_AIR, ForgeOfGodsRingsStructureString.THIRD_RING_AIR) - .addElement('A', classicHatches(TEXTURE_INDEX + 3, 1, GodforgeCasings, 3)) + .addElement( + 'A', + HatchElementBuilder.<MTEForgeOfGods>builder() + .atLeast(InputBus, InputHatch, OutputBus) + .casingIndex(TEXTURE_INDEX + 3) + .dot(1) + .buildAndChain(GodforgeCasings, 3)) .addElement('B', ofBlock(GodforgeCasings, 0)) .addElement('C', ofBlock(GodforgeCasings, 1)) .addElement('D', ofBlock(GodforgeCasings, 2)) @@ -400,7 +424,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, return false; } - if (internalBattery != 0 && !isRenderActive) { + if (internalBattery != 0 && !isRenderActive && !isRendererDisabled) { createRenderer(); } // Check there is 1 input bus @@ -434,7 +458,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, return false; } - if (isUpgradeActive(26)) { + if (isUpgradeActive(CD)) { if (checkPiece(STRUCTURE_PIECE_SECOND_RING, 55, 11, -67)) { ringAmount = 2; destroySecondRing(); @@ -454,7 +478,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, } } - if (isUpgradeActive(29)) { + if (isUpgradeActive(EE)) { if (checkPiece(STRUCTURE_PIECE_THIRD_RING, 47, 13, -76)) { ringAmount = 3; destroyThirdRing(); @@ -487,21 +511,19 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, startRecipeProcessing(); int maxModuleCount = 8; - if (upgrades[26]) { + if (isUpgradeActive(CD)) { maxModuleCount += 4; } - if (upgrades[29]) { + if (isUpgradeActive(EE)) { maxModuleCount += 4; } - boolean isFinalUpgradeUnlocked = upgrades[30]; - if (!mInputBusses.isEmpty()) { - if (internalBattery == 0 || isFinalUpgradeUnlocked) { + if (internalBattery == 0 || isUpgradeActive(END)) { MTEHatchInputBus inputBus = mInputBusses.get(0); ItemStack[] inputBusInventory = inputBus.getRealInventory(); ItemStack itemToAbsorb = STELLAR_FUEL; - if (isFinalUpgradeUnlocked && internalBattery != 0) { + if (isUpgradeActive(END) && internalBattery != 0) { itemToAbsorb = GTOreDictUnificator.get(OrePrefixes.gem, MaterialsUEVplus.GravitonShard, 1); } if (inputBusInventory != null) { @@ -531,7 +553,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, if (stellarFuelAmount >= neededStartupFuel) { stellarFuelAmount -= neededStartupFuel; increaseBattery(neededStartupFuel); - createRenderer(); + if (!isRendererDisabled) createRenderer(); } } } @@ -547,7 +569,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, if (!ConfigHandler.debug.DEBUG_MODE) { determineGravitonShardAmount(); } - if (upgrades[30] && gravitonShardEjection) { + if (isUpgradeActive(END) && gravitonShardEjection) { ejectGravitonShards(); } @@ -562,7 +584,7 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, calculateEnergyDiscountForModules(module, this); setMiscModuleParameters(module, this); queryMilestoneStats(module, this); - if (!upgrades[28]) { + if (!isUpgradeActive(TBF)) { calculateProcessingVoltageForModules(module, this); } } else { @@ -651,19 +673,10 @@ public class MTEForgeOfGods extends TTMultiblockBase implements IConstructable, } 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; |
