diff options
author | GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> | 2023-01-10 04:39:37 +0000 |
---|---|---|
committer | GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> | 2023-01-10 04:39:37 +0000 |
commit | 23544d8a7b5fa1fea2910d93cdf2c723afd4456f (patch) | |
tree | 582d76d215442bb3915be33fc9a05c55143566f8 /src/main/java | |
parent | 9fe15e26d94ad44df5eb860addc9469f6d1a0eed (diff) | |
parent | 575b031b628ba1aaf1bbe0731de9728d0e059356 (diff) | |
download | GT5-Unofficial-23544d8a7b5fa1fea2910d93cdf2c723afd4456f.tar.gz GT5-Unofficial-23544d8a7b5fa1fea2910d93cdf2c723afd4456f.tar.bz2 GT5-Unofficial-23544d8a7b5fa1fea2910d93cdf2c723afd4456f.zip |
Merge remote-tracking branch 'origin/CelestialThingy' into CelestialThingy
Diffstat (limited to 'src/main/java')
5 files changed, 238 insertions, 99 deletions
diff --git a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java index a42fddbfd6..850c31ae94 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/compatibility/dreamcraft/DreamCraftRecipeLoader.java @@ -3383,6 +3383,73 @@ public class DreamCraftRecipeLoader { 1000, 128_000_000); + // UXV Dynamo/energy hatch + TT_recipeAdder.addResearchableAssemblylineRecipe( + getItemContainer("Hatch_Energy_UMV").get(1L), + 384000, + 256, + 800000, + 32, + new Object[] { + getItemContainer("Hull_UXV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.wireGt08, Materials.SuperconductorUMV, 4L), + ItemList.Circuit_Chip_QPIC.get(16L), + getItemContainer("QuantumCircuit").get(2), + ItemList.UHV_Coil.get(32L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UMV.get(4L) + }, + new FluidStack[] { + Materials.SuperCoolant.getFluid(64_000L), + new FluidStack(solderUEV, 80 * 144), + Materials.UUMatter.getFluid(64000L) + }, + getItemContainer("Hatch_Energy_UXV").get(1L), + 1000, + 512_000_000); + + TT_recipeAdder.addResearchableAssemblylineRecipe( + getItemContainer("Hatch_Dynamo_UMV").get(1L), + 384000, + 256, + 800000, + 32, + new Object[] { + getItemContainer("Hull_UXV").get(1L), + GT_OreDictUnificator.get(OrePrefixes.spring, Materials.SuperconductorUMVBase, 16L), + ItemList.Circuit_Chip_QPIC.get(16L), + getItemContainer("QuantumCircuit").get(2), + ItemList.UHV_Coil.get(32L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Reactor_Coolant_Sp_6.get(1L), + ItemList.Electric_Pump_UMV.get(4L) + }, + new FluidStack[] { + Materials.SuperCoolant.getFluid(64_000L), + new FluidStack(solderUEV, 80 * 144), + Materials.UUMatter.getFluid(64000L) + }, + getItemContainer("Hatch_Dynamo_UXV").get(1L), + 1000, + 512_000_000); + // UHV Circuit Wetwaremainframe TT_recipeAdder.addResearchableAssemblylineRecipe( ItemList.Circuit_Wetwaresupercomputer.get(1L), @@ -5740,7 +5807,8 @@ public class DreamCraftRecipeLoader { ItemList.Hatch_Energy_MAX.get(1), getItemContainer("Hatch_Energy_UEV").get(1L), getItemContainer("Hatch_Energy_UIV").get(1L), - getItemContainer("Hatch_Energy_UMV").get(1L) + getItemContainer("Hatch_Energy_UMV").get(1L), + getItemContainer("Hatch_Energy_UXV").get(1L) }; ItemStack[] dynamo_hatches = { @@ -5756,7 +5824,8 @@ public class DreamCraftRecipeLoader { ItemList.Hatch_Dynamo_MAX.get(1), getItemContainer("Hatch_Dynamo_UEV").get(1L), getItemContainer("Hatch_Dynamo_UIV").get(1L), - getItemContainer("Hatch_Dynamo_UMV").get(1L) + getItemContainer("Hatch_Dynamo_UMV").get(1L), + getItemContainer("Hatch_Dynamo_UXV").get(1L) }; Object[] circuits_tier_plus_two = { @@ -5774,6 +5843,8 @@ public class DreamCraftRecipeLoader { new Object[] {OrePrefixes.circuit.get(Materials.Quantum), 1L}, // UXV new Object[] {OrePrefixes.circuit.get(Materials.Quantum), 4L }, // MAX (Technically not MAX, can be changed once MAX circuits become craftable) + new Object[] {OrePrefixes.circuit.get(Materials.Quantum), 16L + }, // MAX (Technically not MAX, can be changed once MAX circuits become craftable) }; ItemStack[] wireless_hatches = { @@ -5790,6 +5861,7 @@ public class DreamCraftRecipeLoader { ItemList.Wireless_Hatch_Energy_UEV.get(1), ItemList.Wireless_Hatch_Energy_UIV.get(1), ItemList.Wireless_Hatch_Energy_UMV.get(1), + ItemList.Wireless_Hatch_Energy_UXV.get(1), }; ItemStack[] wireless_dynamos = { @@ -5806,6 +5878,7 @@ public class DreamCraftRecipeLoader { ItemList.Wireless_Dynamo_Energy_UEV.get(1), ItemList.Wireless_Dynamo_Energy_UIV.get(1), ItemList.Wireless_Dynamo_Energy_UMV.get(1), + ItemList.Wireless_Dynamo_Energy_UXV.get(1), }; // ------------------------ Wireless EU hatches ------------------------ diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java index 7a59e39c6d..bf315e1dfe 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java @@ -1,6 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; import com.github.technus.tectech.TecTech; @@ -217,9 +216,8 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch imple public String[] getDescription() { return new String[] { CommonValues.TEC_MARK_GENERAL, - translateToLocal("gt.blockmachines.hatch.param.desc.0"), // For parametrization of Multiblocks - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD - + translateToLocal("gt.blockmachines.hatch.param.desc.1") + "\u00b2" // E=mine*craft + EnumChatFormatting.DARK_RED + "Deprecated; Now you can set parameter by clicking LED on multiblock GUI.", + EnumChatFormatting.DARK_RED + "If it doesn't work, try removing Parametrizer from multiblock structure.", }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java index 810c04d861..9b795a0a08 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java @@ -1,6 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import static net.minecraft.util.StatCollector.translateToLocal; import static net.minecraft.util.StatCollector.translateToLocalFormatted; import com.github.technus.tectech.TecTech; @@ -162,9 +161,8 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P public String[] getDescription() { return new String[] { CommonValues.TEC_MARK_GENERAL, - translateToLocal("gt.blockmachines.hatch.param.desc.0"), // For parametrization of Multiblocks - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD - + translateToLocal("gt.blockmachines.hatch.param.desc.1") + "\u00b2" // E=mine*craft + EnumChatFormatting.DARK_RED + "Deprecated; Now you can set parameter by clicking LED on multiblock GUI.", + EnumChatFormatting.DARK_RED + "If it doesn't work, try removing Parametrizer from multiblock structure.", }; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index ae1f7fbf56..b3eea38c87 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -34,19 +34,19 @@ import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.util.Vec3Impl; import com.gtnewhorizons.modularui.api.drawable.IDrawable; import com.gtnewhorizons.modularui.api.drawable.UITexture; +import com.gtnewhorizons.modularui.api.math.Alignment; +import com.gtnewhorizons.modularui.api.math.Color; import com.gtnewhorizons.modularui.api.math.Pos2d; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; 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.FakeSyncWidget; -import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import com.gtnewhorizons.modularui.common.widget.*; +import com.gtnewhorizons.modularui.common.widget.textfield.TextFieldWidget; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -86,6 +86,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected static Textures.BlockIcons.CustomIcon ScreenOFF; protected static Textures.BlockIcons.CustomIcon ScreenON; + /** Base ID for the LED window popup. LED 1 I0 will have ID 100, LED 1 I1 101... */ + protected static int LED_WINDOW_BASE_ID = 100; + // Sound resource - same as with screen but override getActivitySound public static final ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_lo_freq"); @@ -2931,7 +2934,92 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt drawTexts(screenElements, inventorySlot); builder.widget(screenElements.setPos(7, 8)); - Widget powerPassButton = new ButtonWidget() + Widget powerPassButton = createPowerPassButton(); + builder.widget(powerPassButton) + .widget(new FakeSyncWidget.BooleanSyncer(() -> ePowerPass, val -> ePowerPass = val)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> ePowerPassCover, val -> ePowerPassCover = val)); + Widget safeVoidButton = createSafeVoidButton(); + builder.widget(safeVoidButton) + .widget(new FakeSyncWidget.BooleanSyncer(() -> eSafeVoid, val -> eSafeVoid = val)); + Widget powerSwitchButton = createPowerSwitchButton(); + builder.widget(powerSwitchButton) + .widget(new FakeSyncWidget.BooleanSyncer( + () -> getBaseMetaTileEntity().isAllowedToWork(), val -> { + if (val) getBaseMetaTileEntity().enableWorking(); + else getBaseMetaTileEntity().disableWorking(); + })); + + builder.widget( + new DrawableWidget() { + @Override + public void draw(float partialTicks) { + super.draw(partialTicks); + LEDCounter = (byte) ((1 + LEDCounter) % 6); + } + }.setDrawable(TecTechUITextures.PICTURE_PARAMETER_BLANK) + .setPos(5, doesBindPlayerInventory() ? 96 : 176) + .setSize(166, 12)); + for (int hatch = 0; hatch < 10; hatch++) { + for (int param = 0; param < 2; param++) { + int ledID = hatch + param * 10; + buildContext.addSyncedWindow( + LED_WINDOW_BASE_ID + ledID, (player) -> createLEDConfigurationWindow(ledID)); + addParameterLED(builder, hatch, param, true); + addParameterLED(builder, hatch, param, false); + } + } + + if (doesBindPlayerInventory()) { + builder.widget(new DrawableWidget() + .setDrawable(TecTechUITextures.PICTURE_UNCERTAINTY_MONITOR_MULTIMACHINE) + .setPos(173, 96) + .setSize(18, 18)); + for (int i = 0; i < 9; i++) { + final int index = i; + builder.widget(new DrawableWidget() + .setDrawable(() -> { + UITexture valid = TecTechUITextures.PICTURE_UNCERTAINTY_VALID[index]; + UITexture invalid = TecTechUITextures.PICTURE_UNCERTAINTY_INVALID[index]; + switch (eCertainMode) { + case 1: // ooo oxo ooo + if (index == 4) return eCertainStatus == 0 ? valid : invalid; + break; + case 2: // ooo xox ooo + if (index == 3) return (eCertainStatus & 1) == 0 ? valid : invalid; + if (index == 5) return (eCertainStatus & 2) == 0 ? valid : invalid; + break; + case 3: // oxo xox oxo + if (index == 1) return (eCertainStatus & 1) == 0 ? valid : invalid; + if (index == 3) return (eCertainStatus & 2) == 0 ? valid : invalid; + if (index == 5) return (eCertainStatus & 4) == 0 ? valid : invalid; + if (index == 7) return (eCertainStatus & 8) == 0 ? valid : invalid; + break; + case 4: // xox ooo xox + if (index == 0) return (eCertainStatus & 1) == 0 ? valid : invalid; + if (index == 2) return (eCertainStatus & 2) == 0 ? valid : invalid; + if (index == 6) return (eCertainStatus & 4) == 0 ? valid : invalid; + if (index == 8) return (eCertainStatus & 8) == 0 ? valid : invalid; + break; + case 5: // xox oxo xox + if (index == 0) return (eCertainStatus & 1) == 0 ? valid : invalid; + if (index == 2) return (eCertainStatus & 2) == 0 ? valid : invalid; + if (index == 4) return (eCertainStatus & 4) == 0 ? valid : invalid; + if (index == 6) return (eCertainStatus & 8) == 0 ? valid : invalid; + if (index == 8) return (eCertainStatus & 16) == 0 ? valid : invalid; + break; + } + return null; + }) + .setPos(174 + (index % 3) * 6, 97 + (index / 3) * 6) + .setSize(4, 4)); + } + builder.widget(new FakeSyncWidget.ByteSyncer(() -> eCertainMode, val -> eCertainMode = val)) + .widget(new FakeSyncWidget.ByteSyncer(() -> eCertainStatus, val -> eCertainStatus = val)); + } + } + + protected ButtonWidget createPowerPassButton() { + Widget button = new ButtonWidget() .setOnClick((clickData, widget) -> { if (isPowerPassButtonEnabled() || ePowerPassCover) { TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click"); @@ -2963,12 +3051,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt .setPos(174, doesBindPlayerInventory() ? 116 : 140) .setSize(16, 16); if (isPowerPassButtonEnabled()) { - powerPassButton.addTooltip("Power Pass").setTooltipShowUpDelay(TOOLTIP_DELAY); + button.addTooltip("Power Pass").setTooltipShowUpDelay(TOOLTIP_DELAY); } - builder.widget(powerPassButton) - .widget(new FakeSyncWidget.BooleanSyncer(() -> ePowerPass, val -> ePowerPass = val)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> ePowerPassCover, val -> ePowerPassCover = val)); - Widget safeVoidButton = new ButtonWidget() + return (ButtonWidget) button; + } + + protected ButtonWidget createSafeVoidButton() { + Widget button = new ButtonWidget() .setOnClick((clickData, widget) -> { if (isSafeVoidButtonEnabled()) { TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click"); @@ -2993,11 +3082,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt .setPos(174, doesBindPlayerInventory() ? 132 : 156) .setSize(16, 16); if (isSafeVoidButtonEnabled()) { - safeVoidButton.addTooltip("Safe Void").setTooltipShowUpDelay(TOOLTIP_DELAY); + button.addTooltip("Safe Void").setTooltipShowUpDelay(TOOLTIP_DELAY); } - builder.widget(safeVoidButton) - .widget(new FakeSyncWidget.BooleanSyncer(() -> eSafeVoid, val -> eSafeVoid = val)); - Widget powerSwitchButton = new ButtonWidget() + return (ButtonWidget) button; + } + + protected ButtonWidget createPowerSwitchButton() { + Widget button = new ButtonWidget() .setOnClick((clickData, widget) -> { if (isAllowedToWorkButtonEnabled()) { TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click"); @@ -3026,85 +3117,45 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt .setPos(174, doesBindPlayerInventory() ? 148 : 172) .setSize(16, 16); if (isAllowedToWorkButtonEnabled()) { - powerSwitchButton.addTooltip("Power Switch").setTooltipShowUpDelay(TOOLTIP_DELAY); - } - builder.widget(powerSwitchButton) - .widget(new FakeSyncWidget.BooleanSyncer( - () -> getBaseMetaTileEntity().isAllowedToWork(), val -> { - if (val) getBaseMetaTileEntity().enableWorking(); - else getBaseMetaTileEntity().disableWorking(); - })); - - builder.widget( - new DrawableWidget() { - @Override - public void draw(float partialTicks) { - super.draw(partialTicks); - LEDCounter = (byte) ((1 + LEDCounter) % 6); - } - }.setDrawable(TecTechUITextures.PICTURE_PARAMETER_BLANK) - .setPos(5, doesBindPlayerInventory() ? 96 : 176) - .setSize(166, 12)); - for (int hatch = 0; hatch < 10; hatch++) { - for (int param = 0; param < 2; param++) { - addParameterLED(builder, hatch, param, true); - addParameterLED(builder, hatch, param, false); - } - } - - if (doesBindPlayerInventory()) { - builder.widget(new DrawableWidget() - .setDrawable(TecTechUITextures.PICTURE_UNCERTAINTY_MONITOR_MULTIMACHINE) - .setPos(173, 96) - .setSize(18, 18)); - for (int i = 0; i < 9; i++) { - final int index = i; - builder.widget(new DrawableWidget() - .setDrawable(() -> { - UITexture valid = TecTechUITextures.PICTURE_UNCERTAINTY_VALID[index]; - UITexture invalid = TecTechUITextures.PICTURE_UNCERTAINTY_INVALID[index]; - switch (eCertainMode) { - case 1: // ooo oxo ooo - if (index == 4) return eCertainStatus == 0 ? valid : invalid; - break; - case 2: // ooo xox ooo - if (index == 3) return (eCertainStatus & 1) == 0 ? valid : invalid; - if (index == 5) return (eCertainStatus & 2) == 0 ? valid : invalid; - break; - case 3: // oxo xox oxo - if (index == 1) return (eCertainStatus & 1) == 0 ? valid : invalid; - if (index == 3) return (eCertainStatus & 2) == 0 ? valid : invalid; - if (index == 5) return (eCertainStatus & 4) == 0 ? valid : invalid; - if (index == 7) return (eCertainStatus & 8) == 0 ? valid : invalid; - break; - case 4: // xox ooo xox - if (index == 0) return (eCertainStatus & 1) == 0 ? valid : invalid; - if (index == 2) return (eCertainStatus & 2) == 0 ? valid : invalid; - if (index == 6) return (eCertainStatus & 4) == 0 ? valid : invalid; - if (index == 8) return (eCertainStatus & 8) == 0 ? valid : invalid; - break; - case 5: // xox oxo xox - if (index == 0) return (eCertainStatus & 1) == 0 ? valid : invalid; - if (index == 2) return (eCertainStatus & 2) == 0 ? valid : invalid; - if (index == 4) return (eCertainStatus & 4) == 0 ? valid : invalid; - if (index == 6) return (eCertainStatus & 8) == 0 ? valid : invalid; - if (index == 8) return (eCertainStatus & 16) == 0 ? valid : invalid; - break; + button.addTooltip("Power Switch").setTooltipShowUpDelay(TOOLTIP_DELAY); + } + return (ButtonWidget) button; + } + + private ModularWindow createLEDConfigurationWindow(int ledID) { + return ModularWindow.builder(100, 40) + .setBackground(TecTechUITextures.BACKGROUND_SCREEN_BLUE) + .setPos((screenSize, mainWindow) -> new Pos2d( + (screenSize.width / 2 - mainWindow.getSize().width / 2) - 110, + (screenSize.height / 2 - mainWindow.getSize().height / 2))) + .widget(ButtonWidget.closeWindowButton(true).setPos(85, 3)) + .widget(new TextFieldWidget() + .setTextColor(Color.LIGHT_BLUE.normal) + .setNumbersDouble((val) -> val) + .setGetter(() -> Double.toString(parametrization.iParamsIn[ledID])) + .setSetter(val -> { + try { + parametrization.iParamsIn[ledID] = Double.parseDouble(val); + } catch (Exception e) { + e.printStackTrace(); } - return null; }) - .setPos(174 + (index % 3) * 6, 97 + (index / 3) * 6) - .setSize(4, 4)); - } - builder.widget(new FakeSyncWidget.ByteSyncer(() -> eCertainMode, val -> eCertainMode = val)) - .widget(new FakeSyncWidget.ByteSyncer(() -> eCertainStatus, val -> eCertainStatus = val)); - } + .setTextAlignment(Alignment.CenterLeft) + .setFocusOnGuiOpen(true) + .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD) + .setPos(5, 20) + .setSize(90, 15)) + .widget(new TextWidget((ledID % 10) + ":" + (ledID / 10) + ":I") + .setDefaultColor(Color.WHITE.normal) + .setTextAlignment(Alignment.Center) + .setPos(5, 5)) + .build(); } private void addParameterLED(ModularWindow.Builder builder, int hatch, int param, boolean input) { final int parameterIndex = hatch + param * 10; final int posIndex = hatch * 2 + param; - DrawableWidget ledWidget = new DrawableWidget() { + ButtonWidget ledWidget = new ButtonWidget() { @Override public void draw(float partialTicks) { IDrawable texture = null; @@ -3184,11 +3235,21 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt // no-op break; } - setDrawable(texture); + setBackground(texture); super.draw(partialTicks); GL11.glColor4f(1f, 1f, 1f, 1f); } - }; + }.setOnClick((clickData, widget) -> { + if (!widget.isClient() + && input + && parametrization.eParamsInStatus[parameterIndex] != LedStatus.STATUS_UNUSED) { + // We don't use CloseAllButMain here in case MB implementation adds their own window + for (int i = 0; i < parametrization.eParamsInStatus.length; i++) { + widget.getContext().closeWindow(LED_WINDOW_BASE_ID + i); + } + widget.getContext().openSyncedWindow(LED_WINDOW_BASE_ID + parameterIndex); + } + }); builder.widget(ledWidget .dynamicTooltip(() -> { if (input) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java index f6016a7482..c2bf711b86 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/Parameters.java @@ -52,6 +52,15 @@ public class Parameters { return false; } + public boolean trySetParameters(int hatchNo, int parameterId, double parameter) { + Group p = groups[hatchNo]; + if (parent.mMaxProgresstime <= 0 || (p != null && p.updateWhileRunning)) { + iParamsIn[hatchNo + 10 * parameterId] = parameter; + return true; + } + return false; + } + public void setToDefaults(int hatch, boolean defaultIn, boolean defaultOut) { Group p = groups[hatch]; if (p == null) { |