aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTec <daniel112092@gmail.com>2019-07-19 18:36:48 +0200
committerTec <daniel112092@gmail.com>2019-07-19 18:36:48 +0200
commit76972b7ecdd99ebf8e6e8e0eafeb16c8a2bea89a (patch)
tree68c136f8636f0c932186a3e8cdced39f3ddad2e2
parent30d55de44f476aa929182f11cf408f0002350139 (diff)
downloadGT5-Unofficial-76972b7ecdd99ebf8e6e8e0eafeb16c8a2bea89a.tar.gz
GT5-Unofficial-76972b7ecdd99ebf8e6e8e0eafeb16c8a2bea89a.tar.bz2
GT5-Unofficial-76972b7ecdd99ebf8e6e8e0eafeb16c8a2bea89a.zip
Better Paramatrizer
-rw-r--r--src/main/java/com/github/technus/tectech/Util.java28
-rw-r--r--src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java8
-rw-r--r--src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java5
-rw-r--r--src/main/java/com/github/technus/tectech/thing/CustomItemList.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java9
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java203
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java160
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java151
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java168
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java106
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java10
-rw-r--r--src/main/resources/assets/gregtech/textures/gui/ParametrizerText.pngbin0 -> 1476 bytes
12 files changed, 829 insertions, 21 deletions
diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java
index 3b1fdf0961..75ae4d3807 100644
--- a/src/main/java/com/github/technus/tectech/Util.java
+++ b/src/main/java/com/github/technus/tectech/Util.java
@@ -69,9 +69,8 @@ public final class Util {
if(bits==null){
return 0;
}
- bits=bits.replaceAll("[^-01]","");
if(bits.length() > 32){
- return 0;
+ throw new NumberFormatException("Too long!");
}
return Integer.parseInt(bits,2);
}
@@ -80,9 +79,8 @@ public final class Util {
if(hex==null){
return 0;
}
- hex=hex.toLowerCase().replaceAll("[^-0-9a-f]","");
if(hex.length()>8){
- return 0;
+ throw new NumberFormatException("Too long!");
}
return Integer.parseInt(hex,16);
}
@@ -91,13 +89,29 @@ public final class Util {
if(str==null){
return 0;
}
- str=str.toLowerCase().replaceAll("[^-0-9.,e]","");
- if(str.length()>8){
+ return Double.parseDouble(str);
+ }
+
+ public static double getValue(String in1) {
+ String str = in1.toLowerCase();
+ double val;
+ try {
+ if (str.contains("b")) {
+ String[] split = str.split("b");
+ val = Util.bitStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", ""));
+ } else if (str.contains("x")) {
+ String[] split = str.split("x");
+ val = Util.hexStringToInt(split[0].replaceAll("[^-]", "") + split[1].replaceAll("_", ""));
+ } else {
+ val = Util.stringToDouble(str);
+ }
+ return val;
+ } catch (Exception e) {
return 0;
}
- return Integer.parseInt(str,16);
}
+
public static String intBitsToString(int number) {
StringBuilder result = new StringBuilder(16);
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 0f20d31f4d..4cfb3697fa 100644
--- a/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java
+++ b/src/main/java/com/github/technus/tectech/loader/NetworkDispatcher.java
@@ -1,5 +1,6 @@
package com.github.technus.tectech.loader;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage;
import com.github.technus.tectech.thing.metaTileEntity.pipe.PipeActivityMessage;
import com.github.technus.tectech.thing.metaTileEntity.RotationMessage;
import com.github.technus.tectech.mechanics.data.ChunkDataMessage;
@@ -20,11 +21,18 @@ public class NetworkDispatcher extends eu.usrv.yamcore.network.PacketDispatcher
public void registerPackets() {
registerMessage(PipeActivityMessage.ServerHandler.class, PipeActivityMessage.PipeActivityQuery.class);
registerMessage(PipeActivityMessage.ClientHandler.class, PipeActivityMessage.PipeActivityData.class);
+
registerMessage(RotationMessage.ServerHandler.class, RotationMessage.RotationQuery.class);
registerMessage(RotationMessage.ClientHandler.class, RotationMessage.RotationData.class);
+
registerMessage(ChunkDataMessage.ServerHandler.class, ChunkDataMessage.ChunkDataQuery.class);
registerMessage(ChunkDataMessage.ClientHandler.class, ChunkDataMessage.ChunkDataData.class);
+
registerMessage(PlayerDataMessage.ServerHandler.class, PlayerDataMessage.PlayerDataQuery.class);
registerMessage(PlayerDataMessage.ClientHandler.class, PlayerDataMessage.PlayerDataData.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/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
index b4867023aa..988fd30031 100644
--- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
@@ -551,8 +551,9 @@ public class MachineLoader implements Runnable {
// Hatches
// ===================================================================================================
- Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15420, "hatch.param.tier.07", "Parametrizer", 7).getStackForm(1L));
- ParametrizerX_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15421, "hatch.param.tier.10", "Parametrizer X", 10).getStackForm(1L));
+ Parametrizer_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15420, "hatch.param.tier.05", "Parametrizer", 5).getStackForm(1L));
+ ParametrizerX_Hatch.set(new GT_MetaTileEntity_Hatch_Param(15421, "hatch.param.tier.07", "Parametrizer X", 7).getStackForm(1L));
+ ParametrizerTXT_Hatch.set(new GT_MetaTileEntity_Hatch_ParamText(15422, "hatch.param.tier.10", "Parametrizer tXt", 10).getStackForm(1L));
Uncertainty_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(15430, "hatch.certain.tier.07", "Uncertainty Resolver", 7).getStackForm(1L));
UncertaintyX_Hatch.set(new GT_MetaTileEntity_Hatch_Uncertainty(15431, "hatch.certain.tier.10", "Uncertainty Resolver X", 10).getStackForm(1L));
diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
index 4657beebb8..969283fa15 100644
--- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
+++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
@@ -74,7 +74,7 @@ public enum CustomItemList implements IItemContainer {
eM_in_UV, eM_in_UHV, eM_in_UEV, eM_in_UIV, eM_in_UMV, eM_in_UXV,
eM_out_UV, eM_out_UHV, eM_out_UEV, eM_out_UIV, eM_out_UMV, eM_out_UXV,
eM_muffler_UV, eM_muffler_UHV, eM_muffler_UEV, eM_muffler_UIV, eM_muffler_UMV, eM_muffler_UXV,
- Parametrizer_Hatch, ParametrizerX_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, dataIn_Hatch, dataOut_Hatch, dataInAss_Hatch, dataOutAss_Hatch,
+ Parametrizer_Hatch, ParametrizerX_Hatch, ParametrizerTXT_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, dataIn_Hatch, dataOut_Hatch, dataInAss_Hatch, dataOutAss_Hatch,
eM_Containment, eM_Containment_Field, eM_Containment_Advanced, eM_Coil, eM_Teleportation, eM_Dimensional, eM_Ultimate_Containment, eM_Ultimate_Containment_Advanced, eM_Ultimate_Containment_Field, eM_Spacetime, eM_Computer_Casing, eM_Computer_Bus, eM_Computer_Vent, eM_Hollow, eM_Power,
debugBlock,
Machine_Multi_Microwave, Machine_Multi_teslaCoil,
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 a4a713626c..e1c99e4080 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
@@ -2,10 +2,7 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch;
import com.github.technus.tectech.CommonValues;
import com.github.technus.tectech.Util;
-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.thing.metaTileEntity.hatch.gui.*;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.Textures;
@@ -54,7 +51,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch {
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- if (mTier > 7) {
+ if (mTier > 5) {
return new GT_Container_ParamAdv(aPlayerInventory, aBaseMetaTileEntity);
}
return new GT_Container_Param(aPlayerInventory, aBaseMetaTileEntity);
@@ -62,7 +59,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch {
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- if (mTier > 7) {
+ if (mTier > 5) {
return new GT_GUIContainer_ParamAdv(aPlayerInventory, aBaseMetaTileEntity);
}
return new GT_GUIContainer_Param(aPlayerInventory, aBaseMetaTileEntity);
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
new file mode 100644
index 0000000000..6a93fac487
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java
@@ -0,0 +1,203 @@
+package com.github.technus.tectech.thing.metaTileEntity.hatch;
+
+import com.github.technus.tectech.CommonValues;
+import com.github.technus.tectech.Util;
+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 cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.objects.GT_RenderedTexture;
+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;
+import net.minecraftforge.fluids.FluidStack;
+
+/**
+ * Created by danie_000 on 15.12.2016.
+ */
+public class GT_MetaTileEntity_Hatch_ParamText extends GT_MetaTileEntity_Hatch {
+ public int param = -1;
+ public String value0s="";
+ public String value1s="";
+ public double value0D = 0;
+ public double value1D = 0;
+ public double input0D = 0;
+ public double input1D = 0;
+ private static Textures.BlockIcons.CustomIcon ScreenON;
+ private static Textures.BlockIcons.CustomIcon ScreenOFF;
+
+ public GT_MetaTileEntity_Hatch_ParamText(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 0, "For parametrization of Multiblocks");
+ Util.setTier(aTier,this);
+ }
+
+ public GT_MetaTileEntity_Hatch_ParamText(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 0, aDescription, aTextures);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister aBlockIconRegister) {
+ super.registerIcons(aBlockIconRegister);
+ ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/PARAM");
+ ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/PARAM_ACTIVE");
+ }
+
+ @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 ITexture[] getTexturesActive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenON)};
+ }
+
+ @Override
+ public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture, new GT_RenderedTexture(ScreenOFF)};
+ }
+
+ //@Override
+ //public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ // if (aBaseMetaTileEntity.isClientSide() && (aTick % 20L == 0L)) {
+ // //refresh casing on state change
+ // int Xpos = aBaseMetaTileEntity.getXCoord();
+ // int Ypos = aBaseMetaTileEntity.getYCoord();
+ // int Zpos = aBaseMetaTileEntity.getZCoord();
+ // try {
+ // aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(Xpos , Ypos, Zpos , Xpos , Ypos, Zpos );
+ // } catch (Exception e) {}
+ // }
+ // super.onPostTick(aBaseMetaTileEntity, aTick);
+ //}
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) {
+ return new GT_MetaTileEntity_Hatch_ParamText(mName, mTier, mDescription, mTextures);
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[]{
+ "Parametrizer ID: " + EnumChatFormatting.GREEN + param,
+ "Value 0S: " + EnumChatFormatting.DARK_AQUA + value0s,
+ "Value 1S: " + EnumChatFormatting.DARK_BLUE + value1s,
+ "Value 0D: " + EnumChatFormatting.AQUA + value0D,
+ "Value 1D: " + EnumChatFormatting.BLUE + value1D,
+ "Input 0D: " + EnumChatFormatting.GOLD + input0D,
+ "Input 1D: " + EnumChatFormatting.YELLOW + input1D,
+ };
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setDouble("eValue0D", value0D);
+ aNBT.setDouble("eValue1D", value1D);
+ aNBT.setDouble("eInput0D", input0D);
+ aNBT.setDouble("eInput1D", input1D);
+ aNBT.setInteger("eParam", param);
+ aNBT.setString("eIeValue0S", value0s);
+ aNBT.setString("eIeValue1S", value1s);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ value0D = aNBT.getDouble("eValue0D");
+ value1D = aNBT.getDouble("eValue1D");
+ input0D = aNBT.getDouble("eInput0D");
+ input1D = aNBT.getDouble("eInput1D");
+ param = aNBT.getInteger("eParam");
+ value0s = aNBT.getString("eIeValue0S");
+ if (value0s==null){
+ value0s="";
+ }
+ value1s = aNBT.getString("eIeValue1S");
+ if(value1s==null){
+ value1s="";
+ }
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return false;
+ }
+
+ @Override
+ public boolean isLiquidInput(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return false;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ CommonValues.TEC_MARK_GENERAL,
+ mDescription,
+ EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "E=mine*craft\u00b2"
+ };
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java
new file mode 100644
index 0000000000..d206143700
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java
@@ -0,0 +1,160 @@
+package com.github.technus.tectech.thing.metaTileEntity.hatch;
+
+
+import com.github.technus.tectech.Util;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.gui.GT_GUIContainer_ParamText;
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import eu.usrv.yamcore.network.client.AbstractClientMessageHandler;
+import eu.usrv.yamcore.network.server.AbstractServerMessageHandler;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import io.netty.buffer.ByteBuf;
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.common.DimensionManager;
+
+public class TextParametersMessage implements IMessage {
+ int mPosX;
+ int mPosY;
+ int mPosZ;
+ int mPosD;
+ String mVal0;
+ String mVal1;
+
+ public TextParametersMessage() {}
+
+ @Override
+ public void fromBytes(ByteBuf pBuffer) {
+ NBTTagCompound tTag = ByteBufUtils.readTag(pBuffer);
+ mPosX = tTag.getInteger("posx");
+ mPosY = tTag.getInteger("posy");
+ mPosZ = tTag.getInteger("posz");
+ mPosD = tTag.getInteger("posd");
+ mVal0 = tTag.getString("value0s");
+ if(mVal0==null) {
+ mVal0="";
+ }
+ mVal1 = tTag.getString("value1s");
+ if(mVal1==null) {
+ mVal1="";
+ }
+ }
+
+ @Override
+ public void toBytes(ByteBuf pBuffer) {
+ NBTTagCompound tFXTag = new NBTTagCompound();
+ tFXTag.setInteger("posx", mPosX);
+ tFXTag.setInteger("posy", mPosY);
+ tFXTag.setInteger("posz", mPosZ);
+ tFXTag.setInteger("posd", mPosD);
+ tFXTag.setString("value0s", mVal0);
+ tFXTag.setString("value1s", mVal1);
+ ByteBufUtils.writeTag(pBuffer, tFXTag);
+ }
+
+ public static class ParametersTextQuery extends TextParametersMessage {
+ public ParametersTextQuery() {}
+
+ public ParametersTextQuery(GT_MetaTileEntity_Hatch_ParamText metaTile) {
+ IGregTechTileEntity base=metaTile.getBaseMetaTileEntity();
+ mPosX=base.getXCoord();
+ mPosY=base.getYCoord();
+ mPosZ=base.getZCoord();
+ mPosD=base.getWorld().provider.dimensionId;
+ }
+ }
+
+ public static class ParametersTextData extends TextParametersMessage{
+ public ParametersTextData() {}
+
+ public ParametersTextData(GT_MetaTileEntity_Hatch_ParamText metaTile) {
+ IGregTechTileEntity base=metaTile.getBaseMetaTileEntity();
+ mPosX=base.getXCoord();
+ mPosY=base.getYCoord();
+ mPosZ=base.getZCoord();
+ mPosD=base.getWorld().provider.dimensionId;
+ mVal0 =metaTile.value0s;
+ mVal1 =metaTile.value1s;
+ }
+ }
+
+ public static class ParametersTextUpdate extends TextParametersMessage{
+ public ParametersTextUpdate() {}
+
+ public ParametersTextUpdate(GT_MetaTileEntity_Hatch_ParamText metaTile) {
+ IGregTechTileEntity base=metaTile.getBaseMetaTileEntity();
+ mPosX=base.getXCoord();
+ mPosY=base.getYCoord();
+ mPosZ=base.getZCoord();
+ mPosD=base.getWorld().provider.dimensionId;
+ mVal0 =metaTile.value0s;
+ mVal1 =metaTile.value1s;
+ }
+ }
+
+ public static class ClientHandler extends AbstractClientMessageHandler<ParametersTextData> {
+ @Override
+ public IMessage handleClientMessage(EntityPlayer pPlayer, ParametersTextData pMessage, MessageContext pCtx) {
+ if(pPlayer.worldObj.provider.dimensionId==pMessage.mPosD){
+ TileEntity te=pPlayer.worldObj.getTileEntity(pMessage.mPosX,pMessage.mPosY,pMessage.mPosZ);
+ if(te instanceof IGregTechTileEntity){
+ IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity();
+ if(meta instanceof GT_MetaTileEntity_Hatch_ParamText){
+ ((GT_MetaTileEntity_Hatch_ParamText) meta).value0s =pMessage.mVal0;
+ ((GT_MetaTileEntity_Hatch_ParamText) meta).value1s =pMessage.mVal1;
+ if(Minecraft.getMinecraft().currentScreen instanceof GT_GUIContainer_ParamText){
+ GT_GUIContainer_ParamText gui=((GT_GUIContainer_ParamText) Minecraft.getMinecraft().currentScreen);
+ if(gui.mContainer==meta){
+ gui.setTextIn0(pMessage.mVal0);
+ gui.setTextIn1(pMessage.mVal1);
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+ }
+
+ public static class ServerHandler extends AbstractServerMessageHandler<ParametersTextQuery> {
+ @Override
+ public IMessage handleServerMessage(EntityPlayer pPlayer, ParametersTextQuery pMessage, MessageContext pCtx) {
+ World world = DimensionManager.getWorld(pMessage.mPosD);
+ if (world != null) {
+ TileEntity te = world.getTileEntity(pMessage.mPosX, pMessage.mPosY, pMessage.mPosZ);
+ if (te instanceof IGregTechTileEntity) {
+ IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity();
+ if (meta instanceof GT_MetaTileEntity_Hatch_ParamText) {
+ return new ParametersTextData((GT_MetaTileEntity_Hatch_ParamText) meta);
+ }
+ }
+ }
+ return null;
+ }
+ }
+
+ public static class ServerUpdateHandler extends AbstractServerMessageHandler<ParametersTextUpdate> {
+ @Override
+ public IMessage handleServerMessage(EntityPlayer pPlayer, ParametersTextUpdate pMessage, MessageContext pCtx) {
+ World world = DimensionManager.getWorld(pMessage.mPosD);
+ if(world!=null){
+ TileEntity te=world.getTileEntity(pMessage.mPosX,pMessage.mPosY,pMessage.mPosZ);
+ if(te instanceof IGregTechTileEntity){
+ IMetaTileEntity meta = ((IGregTechTileEntity) te).getMetaTileEntity();
+ if(meta instanceof GT_MetaTileEntity_Hatch_ParamText){
+ ((GT_MetaTileEntity_Hatch_ParamText) meta).value0s =pMessage.mVal0;
+ ((GT_MetaTileEntity_Hatch_ParamText) meta).value1s =pMessage.mVal1;
+ ((GT_MetaTileEntity_Hatch_ParamText) meta).value0D=Util.getValue(pMessage.mVal0);
+ ((GT_MetaTileEntity_Hatch_ParamText) meta).value1D=Util.getValue(pMessage.mVal1);
+ }
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java
new file mode 100644
index 0000000000..43eea1a123
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java
@@ -0,0 +1,151 @@
+package com.github.technus.tectech.thing.metaTileEntity.hatch.gui;
+
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.Util;
+import com.github.technus.tectech.loader.NetworkDispatcher;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ParamText;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.gui.GT_Slot_Holo;
+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.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+import java.util.Objects;
+
+public class GT_Container_ParamText extends GT_ContainerMetaTile_Machine {
+ public int param = 0;
+ public double value0f = 0;
+ public double value1f = 0;
+ public double input0f = 0;
+ public double input1f = 0;
+ public String value0s="";
+ public String value1s="";
+
+ public GT_Container_ParamText(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1));
+ }
+
+ @Override
+ public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ if (aSlotIndex < 0) {
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+ Slot tSlot = (Slot) inventorySlots.get(aSlotIndex);
+ if (tSlot != null && mTileEntity.getMetaTileEntity() != null) {
+ boolean doStuff = true;
+ GT_MetaTileEntity_Hatch_ParamText paramH = (GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity();
+ switch (aSlotIndex) {
+ case 0:
+ paramH.param -= aShifthold == 1 ? 16 : 4;
+ break;
+ case 1:
+ paramH.param -= aShifthold == 1 ? 2 : 1;
+ break;
+ case 2:
+ paramH.param += aShifthold == 1 ? 16 : 4;
+ break;
+ case 3:
+ paramH.param += aShifthold == 1 ? 2 : 1;
+ break;
+ default:
+ doStuff = false;
+ }
+ if (doStuff) {
+ IGregTechTileEntity base=paramH.getBaseMetaTileEntity();
+ TecTech.proxy.playSound(base,"fx_click");
+ if (paramH.param > 9) {
+ paramH.param = 9;
+ } else if (paramH.param < -1) {
+ paramH.param = -1;
+ }
+ }
+ }
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) {
+ return;
+ }
+ param = ((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).param;
+ value0f = ((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).value0D;
+ value1f = ((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).value1D;
+ input0f = ((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).input0D;
+ input1f = ((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).input1D;
+ for (Object crafter : crafters) {
+ ICrafting var1 = (ICrafting) crafter;
+ Util.sendInteger(param,this,var1,100);
+ Util.sendDouble(value0f,this,var1,102);
+ Util.sendDouble(value1f,this,var1, 106);
+ Util.sendDouble(input0f,this,var1, 110);
+ Util.sendDouble(input1f,this,var1, 114);
+ }
+ if(!Objects.equals(value0s,((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).value0s) ||
+ !Objects.equals(value0s,((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).value0s)){
+ value0s =((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).value0s;
+ value1s =((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity()).value1s;
+ for(Object object:crafters){
+ if(object instanceof EntityPlayerMP){
+ NetworkDispatcher.INSTANCE.sendTo(
+ new TextParametersMessage.ParametersTextData(
+ ((GT_MetaTileEntity_Hatch_ParamText) mTileEntity.getMetaTileEntity())),
+ (EntityPlayerMP)object);
+ }
+ }
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 100:
+ case 101:
+ param=Util.receiveInteger(param,100,par1,par2);
+ return;
+ case 102:
+ case 103:
+ case 104:
+ case 105:
+ value0f=Util.receiveDouble(value0f,102,par1,par2);
+ return;
+ case 106:
+ case 107:
+ case 108:
+ case 109:
+ value1f=Util.receiveDouble(value1f,106,par1,par2);
+ return;
+ case 110:
+ case 111:
+ case 112:
+ case 113:
+ input0f=Util.receiveDouble(input0f,110,par1,par2);
+ return;
+ case 114:
+ case 115:
+ case 116:
+ case 117:
+ input1f=Util.receiveDouble(input1f,114,par1,par2);
+ return;
+ default:
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java
new file mode 100644
index 0000000000..ed1f1acdee
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java
@@ -0,0 +1,168 @@
+package com.github.technus.tectech.thing.metaTileEntity.hatch.gui;
+
+import com.github.technus.tectech.Util;
+import com.github.technus.tectech.font.TecTechFontRender;
+import com.github.technus.tectech.loader.NetworkDispatcher;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_ParamText;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.TextParametersMessage;
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import java.util.Locale;
+import java.util.Objects;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+public class GT_GUIContainer_ParamText extends GT_GUIContainerMetaTile_Machine {
+ private GuiTextField value0tb;
+ private GuiTextField valie1tb;
+
+ public GT_GUIContainer_ParamText(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(new GT_Container_ParamText(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "ParametrizerText.png");
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ value0tb = new GuiTextField(TecTechFontRender.INSTANCE, (this.width - 176) / 2 + 12 + 14, (this.height - 166) / 2 + 26, 156 - 18, 12);
+ value0tb.setMaxStringLength(80);
+ valie1tb = new GuiTextField(TecTechFontRender.INSTANCE, (this.width - 176) / 2 + 12 + 14, (this.height - 166) / 2 + 41, 156 - 18, 12);
+ valie1tb.setMaxStringLength(80);
+ updateValues();
+ }
+
+ @Override
+ public void onGuiClosed() {
+ super.onGuiClosed();
+ value0tb.setFocused(false);
+ valie1tb.setFocused(false);
+ updateValues();
+ }
+
+ @Override
+ protected void keyTyped(char p_73869_1_, int p_73869_2_) {
+ value0tb.textboxKeyTyped(p_73869_1_, p_73869_2_);
+ valie1tb.textboxKeyTyped(p_73869_1_, p_73869_2_);
+ if ((p_73869_2_ != 1 && p_73869_2_ != this.mc.gameSettings.keyBindInventory.getKeyCode()) || (!value0tb.isFocused() && !valie1tb.isFocused())) {
+ super.keyTyped(p_73869_1_, p_73869_2_);
+ }
+ updateValues();
+ }
+
+ @Override
+ public void updateScreen() {
+ super.updateScreen();
+ value0tb.updateCursorCounter();
+ valie1tb.updateCursorCounter();
+ }
+
+ @Override
+ public void drawScreen(int par1, int par2, float par3) {
+ super.drawScreen(par1, par2, par3);
+ value0tb.drawTextBox();
+ valie1tb.drawTextBox();
+ }
+
+ @Override
+ protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) {
+ super.mo