aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2022-11-19 21:10:15 +0900
committermiozune <miozune@gmail.com>2022-11-19 21:10:15 +0900
commitd6dabe7cca31dc2cba2eddce60f2746b0fb5b008 (patch)
tree732891edab5f193d9a7606ae32176967d4750616 /src
parent61f39d261694b409d6551016e3a9f372ce2129ca (diff)
downloadGT5-Unofficial-d6dabe7cca31dc2cba2eddce60f2746b0fb5b008.tar.gz
GT5-Unofficial-d6dabe7cca31dc2cba2eddce60f2746b0fb5b008.tar.bz2
GT5-Unofficial-d6dabe7cca31dc2cba2eddce60f2746b0fb5b008.zip
Parametrizers
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java6
-rw-r--r--src/main/java/com/github/technus/tectech/thing/gui/TecTechUITextures.java18
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java433
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java159
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java154
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java191
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java283
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java156
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java77
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java85
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java207
-rw-r--r--src/main/resources/assets/gregtech/textures/gui/Parametrizer.pngbin262972 -> 0 bytes
-rw-r--r--src/main/resources/assets/gregtech/textures/gui/ParametrizerAdv.pngbin262972 -> 0 bytes
-rw-r--r--src/main/resources/assets/gregtech/textures/gui/ParametrizerText.pngbin1476 -> 0 bytes
-rw-r--r--src/main/resources/assets/gregtech/textures/gui/multimachines/EMDisplay.pngbin5044 -> 0 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/gui/background/screen_blue_parametrizer_txt.pngbin0 -> 489 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/gui/overlay_button/parametrizer_0.pngbin0 -> 185 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/gui/overlay_button/parametrizer_1.pngbin0 -> 190 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/gui/overlay_button/parametrizer_c.pngbin0 -> 217 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/gui/overlay_button/parametrizer_id.pngbin0 -> 200 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/gui/overlay_button/parametrizer_if.pngbin0 -> 228 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/gui/overlay_button/parametrizer_s.pngbin0 -> 221 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/gui/overlay_button/parametrizer_t.pngbin0 -> 181 bytes
-rw-r--r--src/main/resources/assets/tectech/textures/gui/overlay_button/parametrizer_x.pngbin0 -> 196 bytes
24 files changed, 568 insertions, 1201 deletions
diff --git a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java
index 4b57c09ab8..738d7bfc45 100644
--- a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java
+++ b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java
@@ -7,7 +7,6 @@ import com.github.technus.tectech.mechanics.data.PlayerDataMessage;
import com.github.technus.tectech.mechanics.enderStorage.EnderLinkCoverMessage;
import com.github.technus.tectech.mechanics.pipe.PipeActivityMessage;
import com.github.technus.tectech.mechanics.spark.RendererMessage;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage;
public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher {
public static NetworkDispatcher INSTANCE;
@@ -35,10 +34,5 @@ public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher
registerMessage(
EnderLinkCoverMessage.ServerUpdateHandler.class, EnderLinkCoverMessage.EnderLinkCoverUpdate.class);
registerMessage(EnderLinkCoverMessage.ClientHandler.class, EnderLinkCoverMessage.EnderLinkCoverData.class);
-
- registerMessage(TextParametersMessage.ServerHandler.class, TextParametersMessage.ParametersTextQuery.class);
- registerMessage(
- TextParametersMessage.ServerUpdateHandler.class, TextParametersMessage.ParametersTextUpdate.class);
- registerMessage(TextParametersMessage.ClientHandler.class, TextParametersMessage.ParametersTextData.class);
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/gui/TecTechUITextures.java b/src/main/java/com/github/technus/tectech/thing/gui/TecTechUITextures.java
index b09984e388..14ef35b317 100644
--- a/src/main/java/com/github/technus/tectech/thing/gui/TecTechUITextures.java
+++ b/src/main/java/com/github/technus/tectech/thing/gui/TecTechUITextures.java
@@ -11,6 +11,8 @@ public class TecTechUITextures {
public static final AdaptableUITexture BACKGROUND_SCREEN_BLUE =
AdaptableUITexture.of(MODID, "gui/background/screen_blue", 90, 72, 2);
+ public static final UITexture BACKGROUND_SCREEN_BLUE_PARAMETRIZER_TXT =
+ UITexture.fullImage(MODID, "gui/background/screen_blue_parametrizer_txt");
public static final UITexture BUTTON_STANDARD_16x16 = UITexture.fullImage(MODID, "gui/button/standard_16x16");
public static final UITexture BUTTON_STANDARD_LIGHT_16x16 =
@@ -40,6 +42,22 @@ public class TecTechUITextures {
UITexture.fullImage(MODID, "gui/overlay_button/power_pass_off");
public static final UITexture OVERLAY_BUTTON_POWER_PASS_ON =
UITexture.fullImage(MODID, "gui/overlay_button/power_pass_on");
+ public static final UITexture OVERLAY_BUTTON_PARAMETRIZER_ID =
+ UITexture.fullImage(MODID, "gui/overlay_button/parametrizer_id");
+ public static final UITexture OVERLAY_BUTTON_PARAMETRIZER_0 =
+ UITexture.fullImage(MODID, "gui/overlay_button/parametrizer_0");
+ public static final UITexture OVERLAY_BUTTON_PARAMETRIZER_1 =
+ UITexture.fullImage(MODID, "gui/overlay_button/parametrizer_1");
+ public static final UITexture OVERLAY_BUTTON_PARAMETRIZER_X =
+ UITexture.fullImage(MODID, "gui/overlay_button/parametrizer_x");
+ public static final UITexture OVERLAY_BUTTON_PARAMETRIZER_S =
+ UITexture.fullImage(MODID, "gui/overlay_button/parametrizer_s");
+ public static final UITexture OVERLAY_BUTTON_PARAMETRIZER_T =
+ UITexture.fullImage(MODID, "gui/overlay_button/parametrizer_t");
+ public static final UITexture OVERLAY_BUTTON_PARAMETRIZER_C =
+ UITexture.fullImage(MODID, "gui/overlay_button/parametrizer_c");
+ public static final UITexture OVERLAY_BUTTON_PARAMETRIZER_IF =
+ UITexture.fullImage(MODID, "gui/overlay_button/parametrizer_if");
public static final UITexture OVERLAY_SLOT_RACK = UITexture.fullImage(MODID, "gui/overlay_slot/rack");
public static final UITexture OVERLAY_SLOT_MESH = UITexture.fullImage(MODID, "gui/overlay_slot/mesh");
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 ed6e00dccf..7a59e39c6d 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
@@ -3,24 +3,35 @@ 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.thing.metaTileEntity.hatch.gui.GT_Container_Param;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_ParamAdv;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_Param;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_ParamAdv;
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.thing.gui.TecTechUITextures;
import com.github.technus.tectech.util.CommonValues;
import com.github.technus.tectech.util.TT_Utility;
+import com.gtnewhorizons.modularui.api.drawable.IDrawable;
+import com.gtnewhorizons.modularui.api.math.Alignment;
+import com.gtnewhorizons.modularui.api.screen.ModularWindow;
+import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
+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.TextWidget;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.Textures;
+import gregtech.api.gui.modularui.GT_UIInfos;
+import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.modularui.IAddGregtechLogo;
+import gregtech.api.interfaces.modularui.IAddUIWidgets;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.objects.GT_RenderedTexture;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
@@ -30,7 +41,7 @@ import org.apache.commons.lang3.reflect.FieldUtils;
/**
* Created by danie_000 on 15.12.2016.
*/
-public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch {
+public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch implements IAddGregtechLogo, IAddUIWidgets {
public int pointer = 0;
public int param = -1;
public double value0D = 0;
@@ -60,22 +71,6 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch {
}
@Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- if (mTier > 5) { // TODO update mTier to 4 after recipe check
- return new GT_Container_ParamAdv(aPlayerInventory, aBaseMetaTileEntity);
- }
- return new GT_Container_Param(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- if (mTier > 5) { // TODO update mTier to 4 after recipe check
- return new GT_GUIContainer_ParamAdv(aPlayerInventory, aBaseMetaTileEntity);
- }
- return new GT_GUIContainer_Param(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return new ITexture[] {aBaseTexture, new GT_RenderedTexture(ScreenON)};
}
@@ -214,7 +209,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch {
} catch (Exception e) {
clientLocale = "en_US";
}
- aBaseMetaTileEntity.openGUI(aPlayer);
+ GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
return true;
}
@@ -227,4 +222,396 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch {
+ translateToLocal("gt.blockmachines.hatch.param.desc.1") + "\u00b2" // E=mine*craft
};
}
+
+ @Override
+ public boolean useModularUI() {
+ return true;
+ }
+
+ @Override
+ public void addGregTechLogo(ModularWindow.Builder builder) {
+ builder.widget(new DrawableWidget()
+ .setDrawable(TecTechUITextures.PICTURE_TECTECH_LOGO_DARK)
+ .setSize(18, 18)
+ .setPos(112, 55));
+ }
+
+ @Override
+ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
+ final boolean isAdvanced = mTier > 5;
+ builder.widget(new DrawableWidget()
+ .setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE)
+ .setPos(43, 4)
+ .setSize(90, 72));
+
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> param -= shift ? 16 : 4,
+ 7,
+ 4,
+ GT_UITextures.OVERLAY_BUTTON_MINUS_LARGE,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (secondRow.get()) {
+ secondRow.set(false);
+ } else {
+ columnPointer.addAndGet(shift ? -16 : -4);
+ }
+ } else {
+ value0D -= shift ? 4096 : 256;
+ }
+ },
+ 7,
+ 22,
+ GT_UITextures.OVERLAY_BUTTON_MINUS_LARGE,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_0);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (secondRow.get()) {
+ columnPointer.addAndGet(shift ? -16 : -4);
+ } else {
+ secondRow.set(true);
+ }
+ } else {
+ value1D -= shift ? 4096 : 256;
+ }
+ },
+ 7,
+ 40,
+ GT_UITextures.OVERLAY_BUTTON_MINUS_LARGE,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_1);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (shift) {
+ if (secondRow.get()) {
+ value1D = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL);
+ } else {
+ value0D = Double.longBitsToDouble(0xFFFF_FFFF_FFFF_FFFFL);
+ }
+ } else {
+ if (secondRow.get()) {
+ long temp = Double.doubleToLongBits(value1D);
+ temp |= 1L << (long) columnPointer.get();
+ value1D = Double.longBitsToDouble(temp);
+ } else {
+ long temp = Double.doubleToLongBits(value0D);
+ temp |= 1L << (long) columnPointer.get();
+ value0D = Double.longBitsToDouble(temp);
+ }
+ }
+ } else {
+ value0D /= shift ? 4096 : 256;
+ value1D /= shift ? 4096 : 256;
+ }
+ },
+ 7,
+ 58,
+ isAdvanced ? TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_S : GT_UITextures.OVERLAY_BUTTON_MINUS_LARGE,
+ isAdvanced ? null : TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
+
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> param -= shift ? 2 : 1,
+ 25,
+ 4,
+ GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (secondRow.get()) {
+ secondRow.set(false);
+ } else {
+ columnPointer.addAndGet(shift ? -2 : -1);
+ }
+ } else {
+ value0D -= shift ? 16 : 1;
+ }
+ },
+ 25,
+ 22,
+ GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_0);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (secondRow.get()) {
+ columnPointer.addAndGet(shift ? -2 : -1);
+ } else {
+ secondRow.set(true);
+ }
+ } else {
+ value1D -= shift ? 16 : 1;
+ }
+ },
+ 25,
+ 40,
+ GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_1);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (shift) {
+ if (secondRow.get()) {
+ value1D = Double.longBitsToDouble(0);
+ } else {
+ value0D = Double.longBitsToDouble(0);
+ }
+ } else {
+ if (secondRow.get()) {
+ long temp = Double.doubleToLongBits(value1D);
+ temp &= ~(1L << (long) columnPointer.get());
+ value1D = Double.longBitsToDouble(temp);
+ } else {
+ long temp = Double.doubleToLongBits(value0D);
+ temp &= ~(1L << (long) columnPointer.get());
+ value0D = Double.longBitsToDouble(temp);
+ }
+ }
+ } else {
+ value0D /= shift ? 16 : 2;
+ value1D /= shift ? 16 : 2;
+ }
+ },
+ 25,
+ 58,
+ isAdvanced ? TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_C : GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL,
+ isAdvanced ? null : TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_X);
+
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> param += shift ? 2 : 1,
+ 133,
+ 4,
+ GT_UITextures.OVERLAY_BUTTON_PLUS_SMALL,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (secondRow.get()) {
+ secondRow.set(false);
+ } else {
+ columnPointer.addAndGet(shift ? 2 : 1);
+ }
+ } else {
+ value0D += shift ? 16 : 1;
+ }
+ },
+ 133,
+ 22,
+ GT_UITextures.OVERLAY_BUTTON_PLUS_SMALL,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_0);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (secondRow.get()) {
+ columnPointer.addAndGet(shift ? 2 : 1);
+ } else {
+ secondRow.set(true);
+ }
+ } else {
+ value1D += shift ? 16 : 1;
+ }
+ },
+ 133,
+ 40,
+ GT_UITextures.OVERLAY_BUTTON_PLUS_SMALL,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_1);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (shift) {
+ if (secondRow.get()) {
+ value1D = Double.longBitsToDouble(~Double.doubleToLongBits(value1D));
+ } else {
+ value0D = Double.longBitsToDouble(~Double.doubleToLongBits(value1D));
+ }
+ } else {
+ if (secondRow.get()) {
+ long temp = Double.doubleToLongBits(value1D);
+ temp ^= 1L << (long) columnPointer.get();
+ value1D = Double.longBitsToDouble(temp);
+ } else {
+ long temp = Double.doubleToLongBits(value0D);
+ temp ^= 1L << (long) columnPointer.get();
+ value0D = Double.longBitsToDouble(temp);
+ }
+ }
+ } else {
+ value0D *= shift ? 16 : 2;
+ value1D *= shift ? 16 : 2;
+ }
+ },
+ 133,
+ 58,
+ isAdvanced ? TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_T : GT_UITextures.OVERLAY_BUTTON_PLUS_SMALL,
+ isAdvanced ? null : TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
+
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> param += shift ? 16 : 4,
+ 151,
+ 4,
+ GT_UITextures.OVERLAY_BUTTON_PLUS_LARGE,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (secondRow.get()) {
+ secondRow.set(false);
+ } else {
+ columnPointer.addAndGet(shift ? 16 : 4);
+ }
+ } else {
+ value0D += shift ? 4096 : 256;
+ }
+ },
+ 151,
+ 22,
+ GT_UITextures.OVERLAY_BUTTON_PLUS_LARGE,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_0);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ if (secondRow.get()) {
+ columnPointer.addAndGet(shift ? 16 : 4);
+ } else {
+ secondRow.set(true);
+ }
+ } else {
+ value1D += shift ? 4096 : 256;
+ }
+ },
+ 151,
+ 40,
+ GT_UITextures.OVERLAY_BUTTON_PLUS_LARGE,
+ TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_1);
+ addChangeParamButton(
+ builder,
+ (shift, columnPointer, secondRow) -> {
+ if (isAdvanced) {
+ value0D = input0D;
+ value1D = input1D;
+ } else {
+ value0D *= shift ? 4096 : 256;
+ value1D *= shift ? 4096 : 256;
+ }
+ },
+ 151,
+ 58,
+ isAdvanced ? TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_IF : GT_UITextures.OVERLAY_BUTTON_PLUS_LARGE,
+ isAdvanced ? null : TecTechUITextures.OVERLAY_BUTTON_PARAMETRIZER_ID);
+
+ builder.widget(new FakeSyncWidget.IntegerSyncer(() -> pointer, val -> pointer = val))
+ .widget(new FakeSyncWidget.IntegerSyncer(() -> param, val -> param = val))
+ .widget(new FakeSyncWidget.DoubleSyncer(() -> value0D, val -> value0D = val))
+ .widget(new FakeSyncWidget.DoubleSyncer(() -> value1D, val -> value1D = val))
+ .widget(new FakeSyncWidget.DoubleSyncer(() -> input0D, val -> input0D = val))
+ .widget(new FakeSyncWidget.DoubleSyncer(() -> input1D, val -> input1D = val));
+
+ final String CIRCLED_0 = "\u24EA";
+ final String CIRCLED_1 = "\u2460";
+ final String ARROW_DOWN = "\u2b07";
+ final String ARROW_UP = "\u2b06";
+ builder.widget(TextWidget.dynamicString(() -> (isAdvanced ? "Parameters X: " : "Parameters: ") + param)
+ .setSynced(false)
+ .setDefaultColor(COLOR_TEXT_WHITE.get())
+ .setPos(46, 7))
+ .widget(TextWidget.dynamicString(() -> CIRCLED_0 + ARROW_DOWN + TT_Utility.formatNumberExp(input0D))
+ .setSynced(false)
+ .setDefaultColor(0x22ddff)
+ .setPos(46, 16))
+ .widget(TextWidget.dynamicString(() -> CIRCLED_1 + ARROW_DOWN + TT_Utility.formatNumberExp(input1D))
+ .setSynced(false)
+ .setDefaultColor(0x00ffff)
+ .setPos(46, 24))
+ .widget(TextWidget.dynamicString(() -> CIRCLED_0 + ARROW_UP + TT_Utility.formatNumberExp(value0D))
+ .setSynced(false)
+ .setDefaultColor(0x00bbff)
+ .setPos(46, 33))
+ .widget(TextWidget.dynamicString(() -> CIRCLED_1 + ARROW_UP + TT_Utility.formatNumberExp(value1D))
+ .setSynced(false)
+ .setDefaultColor(0x0077ff)
+ .setPos(46, 41))
+ .widget(TextWidget.dynamicString(() -> CIRCLED_0
+ + ARROW_UP
+ + TT_Utility.longBitsToShortString(Double.doubleToLongBits(value0D)))
+ .setSynced(false)
+ .setDefaultColor(0x00bbff)
+ .setScale(.5f)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(46, 50))
+ .widget(TextWidget.dynamicString(() -> CIRCLED_1
+ + ARROW_UP
+ + TT_Utility.longBitsToShortString(Double.doubleToLongBits(value1D)))
+ .setSynced(false)
+ .setDefaultColor(0x0077ff)
+ .setScale(.5f)
+ .setTextAlignment(Alignment.CenterLeft)
+ .setPos(46, 58));
+ if (isAdvanced) {
+ builder.widget(TextWidget.dynamicString(() ->
+ "Pointer " + Integer.toHexString(pointer | 0x10000).substring(1))
+ .setSynced(false)
+ .setDefaultColor(0x0033ff)
+ .setPos(46, 66));
+ }
+ }
+
+ private void addChangeParamButton(
+ ModularWindow.Builder builder,
+ OnClick onClick,
+ int xPos,
+ int yPos,
+ IDrawable overlay1,
+ IDrawable overlay2) {
+ final boolean isAdvanced = mTier > 5;
+ builder.widget(new ButtonWidget()
+ .setOnClick((clickData, widget) -> {
+ AtomicInteger columnPointer = new AtomicInteger(pointer & 0xff);
+ AtomicBoolean secondRow = new AtomicBoolean((pointer & 0x0100) != 0);
+ onClick.accept(clickData.shift, columnPointer, secondRow);
+ TecTech.proxy.playSound(getBaseMetaTileEntity(), "fx_click");
+ if (isAdvanced) {
+ if (columnPointer.get() >= 64) {
+ columnPointer.set(63);
+ } else if (columnPointer.get() < 0) {
+ columnPointer.set(0);
+ }
+ pointer = secondRow.get() ? columnPointer.get() + 0x100 : columnPointer.get();
+ }
+ if (param > 9) {
+ param = 9;
+ } else if (param < -1) {
+ param = -1;
+ }
+ })
+ .setPlayClickSound(false)
+ .setBackground(
+ overlay2 != null
+ ? new IDrawable[] {GT_UITextures.BUTTON_STANDARD, overlay1, overlay2}
+ : new IDrawable[] {GT_UITextures.BUTTON_STANDARD, overlay1})
+ .setSize(18, 18)
+ .setPos(xPos, yPos));
+ }
+
+ @FunctionalInterface
+ private interface OnClick {
+ void accept(boolean shift, AtomicInteger columnPointer, AtomicBoolean secondRow);
+ }
}
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 e241793e0e..810c04d861 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
@@ -3,16 +3,27 @@ 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.loader.NetworkDispatcher;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_Container_ParamText;
-import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_ParamText;
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.thing.gui.TecTechUITextures;
import com.github.technus.tectech.util.CommonValues;
+import com.github.technus.tectech.util.TT_Utility;
+import com.gtnewhorizons.modularui.api.drawable.IDrawable;
+import com.gtnewhorizons.modularui.api.math.Alignment;
+import com.gtnewhorizons.modularui.api.math.Color;
+import com.gtnewhorizons.modularui.api.screen.ModularWindow;
+import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
+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.TextWidget;
+import com.gtnewhorizons.modularui.common.widget.textfield.TextFieldWidget;
+import gregtech.api.gui.modularui.GT_UIInfos;
+import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
@@ -36,20 +47,6 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P
super(aName, aTier, aDescription, aTextures);
}
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- if (aPlayerInventory.player instanceof EntityPlayerMP) {
- NetworkDispatcher.INSTANCE.sendTo(
- new TextParametersMessage.ParametersTextData(this), (EntityPlayerMP) aPlayerInventory.player);
- }
- return new GT_Container_ParamText(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_ParamText(aPlayerInventory, aBaseMetaTileEntity);
- }
-
// @Override
// public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
// if (aBaseMetaTileEntity.isClientSide() && (aTick % 20L == 0L)) {
@@ -157,7 +154,7 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P
} catch (Exception e) {
clientLocale = "en_US";
}
- aBaseMetaTileEntity.openGUI(aPlayer);
+ GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
return true;
}
@@ -170,4 +167,128 @@ public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch_P
+ translateToLocal("gt.blockmachines.hatch.param.desc.1") + "\u00b2" // E=mine*craft
};
}
+
+ @Override
+ public void addGregTechLogo(ModularWindow.Builder builder) {
+ builder.widget(new DrawableWidget()
+ .setDrawable(TecTechUITextures.PICTURE_TECTECH_LOGO_DARK)
+ .setSize(18, 18)
+ .setPos(148, 55));
+ }
+
+ @Override
+ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
+ builder.widget(new DrawableWidget()
+ .setDrawable(TecTechUITextures.BACKGROUND_SCREEN_BLUE_PARAMETRIZER_TXT)
+ .setPos(7, 4)
+ .setSize(162, 72));
+
+ addChangeNumberButton(builder, -16, -4, 7, GT_UITextures.OVERLAY_BUTTON_MINUS_LARGE);
+ addChangeNumberButton(builder, -2, -1, 25, GT_UITextures.OVERLAY_BUTTON_MINUS_SMALL);
+ addChangeNumberButton(builder, 2, 1, 133, GT_UITextures.OVERLAY_BUTTON_PLUS_SMALL);
+ addChangeNumberButton(builder, 16, 4, 151, GT_UITextures.OVERLAY_BUTTON_PLUS_LARGE);
+
+ builder.widget(new FakeSyncWidget.IntegerSyncer(() -> param, val -> param = val))
+ .widget(new FakeSyncWidget.DoubleSyncer(() -> value0D, val -> value0D = val))
+ .widget(new FakeSyncWidget.DoubleSyncer(() -> value1D, val -> value1D = val))
+ .widget(new FakeSyncWidget.DoubleSyncer(() -> input0D, val -> input0D = val))
+ .widget(new FakeSyncWidget.DoubleSyncer(() -> input1D, val -> input1D = val));
+ // .widget(new FakeSyncWidget.StringSyncer(() -> value0s, val -> value0s = val))
+ // .widget(new FakeSyncWidget.StringSyncer(() -> value1s, val -> value1s = val));
+
+ final String CIRCLED_0 = "\u24EA";
+ final String CIRCLED_1 = "\u2460";
+ final String