diff options
| author | GDCloud <93287602+GDCloudstrike@users.noreply.github.com> | 2024-10-21 22:44:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-21 20:44:36 +0000 |
| commit | 4a64dd8ef3bbe98bcc411ab909b86e34bc17fb09 (patch) | |
| tree | 30744b8b96b966fa51971348a12d62cbbc5fd1a1 /src/main/java/tectech | |
| parent | 14b8acb4795a9e1e1e726bf3020148e51f96bce2 (diff) | |
| download | GT5-Unofficial-4a64dd8ef3bbe98bcc411ab909b86e34bc17fb09.tar.gz GT5-Unofficial-4a64dd8ef3bbe98bcc411ab909b86e34bc17fb09.tar.bz2 GT5-Unofficial-4a64dd8ef3bbe98bcc411ab909b86e34bc17fb09.zip | |
Godforge afterparty (#3345)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: serenibyss <10861407+serenibyss@users.noreply.github.com>
Diffstat (limited to 'src/main/java/tectech')
21 files changed, 2334 insertions, 819 deletions
diff --git a/src/main/java/tectech/loader/recipe/Godforge.java b/src/main/java/tectech/loader/recipe/Godforge.java index 30e3a37f2c..981f6b139a 100644 --- a/src/main/java/tectech/loader/recipe/Godforge.java +++ b/src/main/java/tectech/loader/recipe/Godforge.java @@ -758,13 +758,13 @@ public class Godforge implements Runnable { public static void runDevEnvironmentRecipes() { // put something in here to not crash the game in dev environment when opening the manual insertion window - godforgeUpgradeMats.put(0, new ItemStack[] { new ItemStack(Blocks.cobblestone) }); - godforgeUpgradeMats.put(5, new ItemStack[] { new ItemStack(Blocks.cobblestone) }); - godforgeUpgradeMats.put(7, new ItemStack[] { new ItemStack(Blocks.cobblestone) }); - godforgeUpgradeMats.put(11, new ItemStack[] { new ItemStack(Blocks.cobblestone) }); - godforgeUpgradeMats.put(26, new ItemStack[] { new ItemStack(Blocks.cobblestone) }); - godforgeUpgradeMats.put(29, new ItemStack[] { new ItemStack(Blocks.cobblestone) }); - godforgeUpgradeMats.put(30, new ItemStack[] { new ItemStack(Blocks.cobblestone) }); + godforgeUpgradeMats.put(0, new ItemStack[] { new ItemStack(Blocks.cobblestone, 4) }); + godforgeUpgradeMats.put(5, new ItemStack[] { new ItemStack(Blocks.cobblestone, 8) }); + godforgeUpgradeMats.put(7, new ItemStack[] { new ItemStack(Blocks.cobblestone, 12) }); + godforgeUpgradeMats.put(11, new ItemStack[] { new ItemStack(Blocks.cobblestone, 16) }); + godforgeUpgradeMats.put(26, new ItemStack[] { new ItemStack(Blocks.cobblestone, 32) }); + godforgeUpgradeMats.put(29, new ItemStack[] { new ItemStack(Blocks.cobblestone, 48) }); + godforgeUpgradeMats.put(30, new ItemStack[] { new ItemStack(Blocks.cobblestone, 64) }); } public static void initMoltenModuleRecipes() { diff --git a/src/main/java/tectech/loader/thing/MachineLoader.java b/src/main/java/tectech/loader/thing/MachineLoader.java index 36b8b03c12..bf8f2e740a 100644 --- a/src/main/java/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/tectech/loader/thing/MachineLoader.java @@ -641,16 +641,16 @@ import tectech.thing.metaTileEntity.multi.MTEActiveTransformer; import tectech.thing.metaTileEntity.multi.MTEDataBank; import tectech.thing.metaTileEntity.multi.MTEEnergyInfuser; import tectech.thing.metaTileEntity.multi.MTEEyeOfHarmony; -import tectech.thing.metaTileEntity.multi.MTEForgeOfGods; import tectech.thing.metaTileEntity.multi.MTEMicrowave; import tectech.thing.metaTileEntity.multi.MTENetworkSwitch; import tectech.thing.metaTileEntity.multi.MTEQuantumComputer; import tectech.thing.metaTileEntity.multi.MTEResearchStation; import tectech.thing.metaTileEntity.multi.MTETeslaTower; -import tectech.thing.metaTileEntity.multi.godforge_modules.MTEExoticModule; -import tectech.thing.metaTileEntity.multi.godforge_modules.MTEMoltenModule; -import tectech.thing.metaTileEntity.multi.godforge_modules.MTEPlasmaModule; -import tectech.thing.metaTileEntity.multi.godforge_modules.MTESmeltingModule; +import tectech.thing.metaTileEntity.multi.godforge.MTEExoticModule; +import tectech.thing.metaTileEntity.multi.godforge.MTEForgeOfGods; +import tectech.thing.metaTileEntity.multi.godforge.MTEMoltenModule; +import tectech.thing.metaTileEntity.multi.godforge.MTEPlasmaModule; +import tectech.thing.metaTileEntity.multi.godforge.MTESmeltingModule; import tectech.thing.metaTileEntity.pipe.MTEPipeBlockData; import tectech.thing.metaTileEntity.pipe.MTEPipeBlockEnergy; import tectech.thing.metaTileEntity.pipe.MTEPipeData; diff --git a/src/main/java/tectech/loader/thing/ThingsLoader.java b/src/main/java/tectech/loader/thing/ThingsLoader.java index 7844a6865e..219bed8852 100644 --- a/src/main/java/tectech/loader/thing/ThingsLoader.java +++ b/src/main/java/tectech/loader/thing/ThingsLoader.java @@ -17,6 +17,7 @@ import tectech.thing.casing.SpacetimeCompressionFieldCasing; import tectech.thing.casing.StabilisationFieldCasing; import tectech.thing.casing.TTCasingsContainer; import tectech.thing.casing.TimeAccelerationFieldCasing; +import tectech.thing.item.FakeItemQGP; import tectech.thing.item.ItemAstralArrayFabricator; import tectech.thing.item.ItemEnderFluidLinkCover; import tectech.thing.item.ItemEuMeterGT; @@ -84,6 +85,7 @@ public class ThingsLoader implements Runnable { ItemTeslaCoilComponent.run(); ItemAstralArrayFabricator.run(); + FakeItemQGP.run(); TecTech.LOGGER.info("Crafting Components registered"); TecTech.LOGGER.info("Debug Items registered"); diff --git a/src/main/java/tectech/thing/CustomItemList.java b/src/main/java/tectech/thing/CustomItemList.java index 2c4b4c895b..5788b82259 100644 --- a/src/main/java/tectech/thing/CustomItemList.java +++ b/src/main/java/tectech/thing/CustomItemList.java @@ -461,6 +461,7 @@ public enum CustomItemList implements IItemContainer { Godforge_GravitonFlowModulatorTier2, Godforge_GravitonFlowModulatorTier3, Godforge_HarmonicPhononTransmissionConduit, + Godforge_FakeItemQGP, astralArrayFabricator; diff --git a/src/main/java/tectech/thing/block/RenderForgeOfGods.java b/src/main/java/tectech/thing/block/RenderForgeOfGods.java index 498db3b9ed..9091434490 100644 --- a/src/main/java/tectech/thing/block/RenderForgeOfGods.java +++ b/src/main/java/tectech/thing/block/RenderForgeOfGods.java @@ -28,8 +28,8 @@ 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.thing.metaTileEntity.multi.godforge.ForgeOfGodsRingsStructureString; +import tectech.thing.metaTileEntity.multi.godforge.ForgeOfGodsStructureString; import tectech.util.StructureVBO; import tectech.util.TextureUpdateRequester; @@ -429,9 +429,7 @@ public class RenderForgeOfGods extends TileEntitySpecialRenderer { long millis = System.currentTimeMillis() % (1000 * 36000); float timer = millis / (50f); // to ticks - if (forgeTile.getRainbowMode()) { - forgeTile.incrementRainbowColors(); - } + forgeTile.incrementColors(); RenderEntireStar(forgeTile, x, y, z, timer); RenderRings(forgeTile, x, y, z, timer); diff --git a/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java b/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java index 49ab89de2b..a8a8992a63 100644 --- a/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java +++ b/src/main/java/tectech/thing/block/TileEntityForgeOfGods.java @@ -1,5 +1,10 @@ package tectech.thing.block; +import static tectech.thing.metaTileEntity.multi.godforge.color.ForgeOfGodsStarColor.DEFAULT_BLUE; +import static tectech.thing.metaTileEntity.multi.godforge.color.ForgeOfGodsStarColor.DEFAULT_GAMMA; +import static tectech.thing.metaTileEntity.multi.godforge.color.ForgeOfGodsStarColor.DEFAULT_GREEN; +import static tectech.thing.metaTileEntity.multi.godforge.color.ForgeOfGodsStarColor.DEFAULT_RED; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; @@ -9,33 +14,41 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizon.structurelib.alignment.enumerable.Rotation; +import com.gtnewhorizons.modularui.api.math.Color; + +import tectech.thing.metaTileEntity.multi.godforge.color.ForgeOfGodsStarColor; +import tectech.thing.metaTileEntity.multi.godforge.color.StarColorSetting; public class TileEntityForgeOfGods extends TileEntity { 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 int rainbowR = 255, rainbowG = 0, rainbowB = 0; - private int rainbowState = 0; - private boolean rainbowMode = false; - private int rainbowCycleSpeed = 1; + + private ForgeOfGodsStarColor starColor = ForgeOfGodsStarColor.DEFAULT; + + // current color data + private int currentColor = Color.rgb(DEFAULT_RED, DEFAULT_GREEN, DEFAULT_BLUE); + private float gamma = DEFAULT_GAMMA; + + // interpolation color data + private int cycleStep; + private int interpIndex; + private int interpA; + private int interpB; + private float interpGammaA; + private float interpGammaB; 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"; - private static final String RAINBOW_MODE_NBT_TAG = NBT_TAG + "RAINBOW_MODE"; - private static final String RAINBOW_MODE_CYCLE_SPEED_NBT_TAG = NBT_TAG + "RAINBOW_MODE_CYCLE_SPEED"; + private static final String STAR_COLOR_TAG = NBT_TAG + "STAR_COLOR"; public static final float BACK_PLATE_DISTANCE = -121.5f, BACK_PLATE_RADIUS = 13f; @@ -66,39 +79,39 @@ public class TileEntityForgeOfGods extends TileEntity { } public float getColorR() { - return rainbowMode ? rainbowR / 255f : colorR; + return Color.getRedF(currentColor); } public float getColorG() { - return rainbowMode ? rainbowG / 255f : colorG; + return Color.getGreenF(currentColor); } public float getColorB() { - return rainbowMode ? rainbowB / 255f : colorB; + return Color.getBlueF(currentColor); } 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 void setRainbowMode(boolean state, int cycleSpeed) { - this.rainbowMode = state; - this.rainbowCycleSpeed = cycleSpeed; - } + public void setColor(ForgeOfGodsStarColor color) { + this.starColor = color; + if (this.starColor == null) { + this.starColor = ForgeOfGodsStarColor.DEFAULT; + } - public boolean getRainbowMode() { - return rainbowMode; + StarColorSetting colorSetting = starColor.getColor(0); + currentColor = Color.rgb(colorSetting.getColorR(), colorSetting.getColorG(), colorSetting.getColorB()); + gamma = colorSetting.getGamma(); + + if (starColor.numColors() > 1) { + cycleStep = 0; + interpA = currentColor; + interpGammaA = gamma; + colorSetting = starColor.getColor(1); + interpB = Color.rgb(colorSetting.getColorR(), colorSetting.getColorG(), colorSetting.getColorB()); + interpGammaB = colorSetting.getGamma(); + } } public int getRingCount() { @@ -172,49 +185,46 @@ public class TileEntityForgeOfGods extends TileEntity { return y0 + ((x - x0) * (y1 - y0)) / (x1 - x0); } - public void incrementRainbowColors() { - if (rainbowState == 0) { - rainbowG += rainbowCycleSpeed; - if (rainbowG >= 255) { - rainbowG = 255; - rainbowState = 1; + public void incrementColors() { + if (starColor.numColors() > 1) { + cycleStep += starColor.getCycleSpeed(); + + if (cycleStep < 255) { + // interpolate like normal between these two colors + interpolateColors(); + } else if (cycleStep == 255) { + // interpolate like normal, but then update interp values to the next set and reset cycleStep + cycleStarColors(); + currentColor = interpA; + gamma = interpGammaA; + cycleStep = 0; + } else { + // update interp values to the next set, reset cycleStep then interpolate + cycleStep = -255; + cycleStarColors(); + interpolateColors(); } } - if (rainbowState == 1) { - rainbowR -= rainbowCycleSpeed; - if (rainbowR <= 0) { - rainbowR = 0; - rainbowState = 2; - } - } - if (rainbowState == 2) { - rainbowB += rainbowCycleSpeed; - if (rainbowB >= 255) { - rainbowB = 255; - rainbowState = 3; - } - } - if (rainbowState == 3) { - rainbowG -= rainbowCycleSpeed; - if (rainbowG <= 0) { - rainbowG = 0; - rainbowState = 4; - } - } - if (rainbowState == 4) { - rainbowR += rainbowCycleSpeed; - if (rainbowR >= 255) { - rainbowR = 255; - rainbowState = 5; - } - } - if (rainbowState == 5) { - rainbowB -= rainbowCycleSpeed; - if (rainbowB <= 0) { - rainbowB = 0; - rainbowState = 0; - } + } + + private void interpolateColors() { + float position = cycleStep / 255.0f; + currentColor = Color.interpolate(interpA, interpB, position); + gamma = interpGammaA + (interpGammaB - interpGammaA) * position; + } + + private void cycleStarColors() { + interpA = interpB; + interpGammaA = interpGammaB; + + interpIndex++; + if (interpIndex >= starColor.numColors()) { + interpIndex = 0; } + StarColorSetting nextColor = starColor.getColor(interpIndex); + + interpB = Color.rgb(nextColor.getColorR(), nextColor.getColorG(), nextColor.getColorB()); + interpGammaB = nextColor.getGamma(); } @Override @@ -223,16 +233,11 @@ public class TileEntityForgeOfGods extends TileEntity { compound.setFloat(ROTATION_SPEED_NBT_TAG, rotationSpeed); 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); - compound.setBoolean(RAINBOW_MODE_NBT_TAG, rainbowMode); - compound.setInteger(RAINBOW_MODE_CYCLE_SPEED_NBT_TAG, rainbowCycleSpeed); + compound.setTag(STAR_COLOR_TAG, starColor.serializeToNBT()); } @Override @@ -244,16 +249,14 @@ public class TileEntityForgeOfGods extends TileEntity { 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); - rainbowMode = compound.getBoolean(RAINBOW_MODE_NBT_TAG); - rainbowCycleSpeed = compound.getInteger(RAINBOW_MODE_CYCLE_SPEED_NBT_TAG); + + if (compound.hasKey(STAR_COLOR_TAG)) { + setColor(ForgeOfGodsStarColor.deserialize(compound.getCompoundTag(STAR_COLOR_TAG))); + } } @Override diff --git a/src/main/java/tectech/thing/gui/TecTechUITextures.java b/src/main/java/tectech/thing/gui/TecTechUITextures.java index 298d528e21..89fb7c5b11 100644 --- a/src/main/java/tectech/thing/gui/TecTechUITextures.java +++ b/src/main/java/tectech/thing/gui/TecTechUITextures.java @@ -24,6 +24,8 @@ public class TecTechUITextures { public static final UITexture BACKGROUND_GLOW_GREEN = UITexture.fullImage(MODID, "gui/background/green_glow"); public static final UITexture BACKGROUND_GLOW_RED = UITexture.fullImage(MODID, "gui/background/red_glow"); public static final UITexture BACKGROUND_GLOW_WHITE = UITexture.fullImage(MODID, "gui/background/white_glow"); + public static final UITexture BACKGROUND_GLOW_WHITE_HALF = UITexture + .fullImage(MODID, "gui/background/white_glow_half"); 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"); @@ -89,6 +91,38 @@ public class TecTechUITextures { .fullImage(MODID, "gui/overlay_button/rainbow_spiral"); public static final UITexture OVERLAY_BUTTON_RAINBOW_SPIRAL_OFF = UITexture .fullImage(MODID, "gui/overlay_button/rainbow_spiral_off"); + public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION = UITexture + .fullImage(MODID, "gui/overlay_button/input_separation_on"); + public static final UITexture OVERLAY_BUTTON_INPUT_SEPARATION_OFF = UITexture + .fullImage(MODID, "gui/overlay_button/input_separation_off"); + public static final UITexture OVERLAY_BUTTON_BATCH_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/batch_mode_on"); + public static final UITexture OVERLAY_BUTTON_BATCH_MODE_OFF = UITexture + .fullImage(MODID, "gui/overlay_button/batch_mode_off"); + public static final UITexture OVERLAY_BUTTON_LOAF_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/loaf_mode_on"); + public static final UITexture OVERLAY_BUTTON_LOAF_MODE_OFF = UITexture + .fullImage(MODID, "gui/overlay_button/loaf_mode_off"); + public static final UITexture OVERLAY_BUTTON_RECIPE_LOCKED = UITexture + .fullImage(MODID, "gui/overlay_button/recipe_locked"); + public static final UITexture OVERLAY_BUTTON_RECIPE_UNLOCKED = UITexture + .fullImage(MODID, "gui/overlay_button/recipe_unlocked"); + public static final UITexture OVERLAY_BUTTON_VOIDING_OFF = UITexture + .fullImage(MODID, "gui/overlay_button/voiding_disabled"); + public static final UITexture OVERLAY_BUTTON_VOIDING_ITEMS = UITexture + .fullImage(MODID, "gui/overlay_button/voiding_items"); + public static final UITexture OVERLAY_BUTTON_VOIDING_FLUIDS = UITexture + .fullImage(MODID, "gui/overlay_button/voiding_fluids"); + public static final UITexture OVERLAY_BUTTON_VOIDING_BOTH = UITexture + .fullImage(MODID, "gui/overlay_button/voiding_both"); + public static final UITexture OVERLAY_BUTTON_STRUCTURE_CHECK = UITexture + .fullImage(MODID, "gui/overlay_button/structure_check_on"); + public static final UITexture OVERLAY_BUTTON_STRUCTURE_CHECK_OFF = UITexture + .fullImage(MODID, "gui/overlay_button/structure_check_off"); + public static final UITexture OVERLAY_BUTTON_FURNACE_MODE = UITexture + .fullImage(MODID, "gui/overlay_button/furnace_mode_on"); + public static final UITexture OVERLAY_BUTTON_FURNACE_MODE_OFF = UITexture + .fullImage(MODID, "gui/overlay_button/furnace_mode_off"); 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"); @@ -145,6 +179,7 @@ public class TecTechUITextures { .collect(Collectors.toList()) .toArray(new UITexture[0]); public static final UITexture PICTURE_HEAT_SINK_SMALL = UITexture.fullImage(MODID, "gui/picture/heat_sink_small"); + public static final UITexture PICTURE_HEAT_SINK_16x8 = UITexture.fullImage(MODID, "gui/picture/heat_sink_16x8"); public static final UITexture PICTURE_PARAMETER_BLANK = UITexture.fullImage(MODID, "gui/picture/parameter_blank"); public static final UITexture[] PICTURE_PARAMETER_BLUE = IntStream.range(0, 20) .mapToObj(i -> UITexture.partly(MODID, "gui/picture/parameter_blue", 158, 4, i * 8, 0, i * 8 + 6, 4)) @@ -190,6 +225,7 @@ public class TecTechUITextures { 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 UNSELECTED_OPTION = UITexture.fullImage(MODID, "gui/picture/unselected_option"); public static final UITexture PICTURE_GODFORGE_MILESTONE_CHARGE = UITexture .fullImage(MODID, "gui/picture/milestone_charge"); public static final UITexture PICTURE_GODFORGE_MILESTONE_CONVERSION = UITexture diff --git a/src/main/java/tectech/thing/item/FakeItemQGP.java b/src/main/java/tectech/thing/item/FakeItemQGP.java new file mode 100644 index 0000000000..a3d6929e0f --- /dev/null +++ b/src/main/java/tectech/thing/item/FakeItemQGP.java @@ -0,0 +1,34 @@ +package tectech.thing.item; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.Item; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import tectech.Reference; +import tectech.thing.CustomItemList; + +public class FakeItemQGP extends Item { + + public static FakeItemQGP INSTANCE; + + private FakeItemQGP() { + setHasSubtypes(false); + setUnlocalizedName("tm.fakeItemQGP"); + setTextureName(Reference.MODID + ":fakeItemQGP"); + } + + public static void run() { + INSTANCE = new FakeItemQGP(); + GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); + CustomItemList.Godforge_FakeItemQGP.set(INSTANCE) + .hidden(); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + itemIcon = iconRegister.registerIcon(getIconString()); + } +} diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/ForgeOfGodsRingsStructureString.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/ForgeOfGodsRingsStructureString.java index 56aabb28ec..fcff5c7026 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/ForgeOfGodsRingsStructureString.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/ForgeOfGodsRingsStructureString.java @@ -1,4 +1,4 @@ -package tectech.thing.metaTileEntity.multi; +package tectech.thing.metaTileEntity.multi.godforge; import static tectech.util.TTUtility.replaceLetters; diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/ForgeOfGodsStructureString.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/ForgeOfGodsStructureString.java index 776689eee5..1780be0079 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/ForgeOfGodsStructureString.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/ForgeOfGodsStructureString.java @@ -1,4 +1,4 @@ -package tectech.thing.metaTileEntity.multi; +package tectech.thing.metaTileEntity.multi.godforge; import static tectech.util.TTUtility.appendStringArrays; import static tectech.util.TTUtility.replaceLetters; diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/godforge/ForgeOfGodsUI.java b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/ForgeOfGodsUI.java new file mode 100644 index 0000000000..a63ba81d7e --- /dev/null +++ b/src/main/java/tectech/thing/metaTileEntity/multi/godforge/ForgeOfGodsUI.java @@ -0,0 +1,549 @@ +package tectech.thing.metaTileEntity.multi.godforge; + +import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; +import static net.minecraft.util.StatCollector.translateToLocal; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Set; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.DoubleConsumer; +import java.util.function.DoubleSupplier; +import java.util.function.Supplier; + +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +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.math.Alignment; +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.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.DynamicTextWidget; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; +import com.gtnewhorizons.modularui.common.widget.MultiChildWidget; +import com.gtnewhorizons.modularui.common.widget.Scrollable; +import com.gtnewhorizons.modularui.common.widget.SliderWidget; +import com.gtnewhorizons.modularui.common.widget.TextWidget; +import com.gtnewhorizons.modularui.common.widget.textfield.NumericWidget; + +import gregtech.api.enums.VoidingMode; +import gregtech.api.gui.modularui.GTUITextures; +import gregtech.api.interfaces.modularui.IControllerWithOptionalFeatures; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import tectech.TecTech; +import tectech.thing.gui.TecTechUITextures; +import tectech.thing.metaTileEntity.multi.godforge.color.ForgeOfGodsStarColor; + +/** + * Holds UI element builders and other conveniences shared between the primary Forge of the Gods and its modules. + */ +public class ForgeOfGodsUI { + + // ARGB representations of the 4 colors used in the color selector (red, green, blue, gold) + public static final int RED_ARGB = 0xFFFF5555; + public static final int GREEN_ARGB = 0xFF55FF55; + public static final int BLUE_ARGB = 0xFF0000AA; + public static final int GOLD_ARGB = 0xFFFFAA00; + + public static ButtonWidget createPowerSwitchButton(final IGregTechTileEntity tileEntity) { + Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { + TecTech.proxy.playSound(tileEntity, "fx_click"); + if (tileEntity.isAllowedToWork()) { + tileEntity.disableWorking(); + } else { + tileEntity.enableWorking(); + } + }) + .setPlayClickSound(false) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(TecTechUITextures.BUTTON_CELESTIAL_32x32); + if (tileEntity.isAllowedToWork()) { + ret.add(TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_ON); + } else { + ret.add(TecTechUITextures.OVERLAY_BUTTON_POWER_SWITCH_DISABLED); + } + return ret.toArray(new IDrawable[0]); + }) + .setPos(174, 148) + .setSize(16, 16); + button.addTooltip("Power Switch") + .setTooltipShowUpDelay(TOOLTIP_DELAY); + return (ButtonWidget) button; + } + + public static ButtonWidget createInputSeparationButton(final IGregTechTileEntity tileEntity, + final IControllerWithOptionalFeatures mte, IWidgetBuilder<?> builder) { + Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { + TecTech.proxy.playSound(tileEntity, "fx_click"); + mte.setInputSeparation(!mte.isInputSeparationEnabled()); + }) + .setPlayClickSound(false) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(TecTechUITextures.BUTTON_CELESTIAL_32x32); + if (mte.isInputSeparationEnabled()) { + ret.add(TecTechUITextures.OVERLAY_BUTTON_INPUT_SEPARATION); + } else { + ret.add(TecTechUITextures.OVERLAY_BUTTON_INPUT_SEPARATION_OFF); + } + return ret.toArray(new IDrawable[0]); + }) + .attachSyncer( + new FakeSyncWidget.BooleanSyncer(mte::isInputSeparationEnabled, mte::setInputSeparation), + builder) + .addTooltip(StatCollector.translateToLocal("GT5U.gui.button.input_separation")) + .setTooltipShowUpDelay(TOOLTIP_DELAY) + .setPos(mte.getInputSeparationButtonPos()) + .setSize(16, 16); + return (ButtonWidget) button; + } + + public static ButtonWidget createBatchModeButton(final IGregTechTileEntity tileEntity, + final IControllerWithOptionalFeatures mte, IWidgetBuilder<?> builder) { + Widget button = new ButtonWidget().setOnClick((clickData, widget) -> { + TecTech.proxy.playSound(tileEntity, "fx_click"); + mte.setBatchMode(!mte.isBatchModeEnabled()); + }) + .setPlayClickSound(false) + .setBackground(() -> { + List<UITexture> ret = new ArrayList<>(); + ret.add(TecTechUITextures.BUTTON_CELESTIAL_32x32); + if (mte.isBatchModeEnabled()) { + ret.add(TecTechUITextures.OVERLAY_BUTTON_BATCH_MODE); + } else { + |
