From 76972b7ecdd99ebf8e6e8e0eafeb16c8a2bea89a Mon Sep 17 00:00:00 2001 From: Tec Date: Fri, 19 Jul 2019 18:36:48 +0200 Subject: Better Paramatrizer --- src/main/java/com/github/technus/tectech/Util.java | 28 ++- .../technus/tectech/loader/NetworkDispatcher.java | 8 + .../tectech/loader/thing/MachineLoader.java | 5 +- .../technus/tectech/thing/CustomItemList.java | 2 +- .../hatch/GT_MetaTileEntity_Hatch_Param.java | 9 +- .../hatch/GT_MetaTileEntity_Hatch_ParamText.java | 203 +++++++++++++++++++++ .../hatch/TextParametersMessage.java | 160 ++++++++++++++++ .../hatch/gui/GT_Container_ParamText.java | 151 +++++++++++++++ .../hatch/gui/GT_GUIContainer_ParamText.java | 168 +++++++++++++++++ .../multi/GT_MetaTileEntity_EM_bhg.java | 106 +++++++++++ .../multi/GT_MetaTileEntity_EM_decay.java | 10 +- 11 files changed, 829 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ParamText.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/TextParametersMessage.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamText.java create mode 100644 src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamText.java (limited to 'src/main/java') 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 { + @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 { + @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 { + @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.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); + value0tb.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); + valie1tb.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); + updateValues(); + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + if (mContainer != null) { + TecTechFontRender.INSTANCE.drawSplitString("Parameters tXt: " + ((GT_Container_ParamText) mContainer).param, 46, 7, 167, 0xffffff); + Locale locale = Locale.getDefault(); + TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b06", 10, 29, 16, 0x00bbff); + TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b06", 10, 44, 16, 0x0077ff); + TecTechFontRender.INSTANCE.drawSplitString("\u24EA\u2b07" + String.format(locale, "%+.5E", (((GT_Container_ParamText) mContainer).input0f)), 10, 56, 167, 0x22ddff); + TecTechFontRender.INSTANCE.drawSplitString("\u2460\u2b07" + String.format(locale, "%+.5E", (((GT_Container_ParamText) mContainer).input1f)), 10, 65, 167, 0x00ffff); + } else { + TecTechFontRender.INSTANCE.drawSplitString("Parameters tXt", 46, 7, 167, 0xffffff); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } + + private void updateValues() { + updateIn0(); + updateIn1(); + } + + private void updateIn0() { + if (!value0tb.isFocused()) { + String str = value0tb.getText().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); + } + if (!Objects.equals(((GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity()).value0s, value0tb.getText())) { + ((GT_Container_ParamText) mContainer).value0s = value0tb.getText(); + ((GT_Container_ParamText) mContainer).value0f = val; + ((GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity()).value0s = value0tb.getText(); + + NetworkDispatcher.INSTANCE.sendToServer(new TextParametersMessage.ParametersTextUpdate( + (GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity())); + } + } catch (Exception e) { + value0tb.setText(((GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity()).value0s); + } + } + } + + private void updateIn1() { + if (!valie1tb.isFocused()) { + String str = valie1tb.getText().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); + } + if (!Objects.equals(((GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity()).value1s, valie1tb.getText())) { + ((GT_Container_ParamText) mContainer).value1s = valie1tb.getText(); + ((GT_Container_ParamText) mContainer).value1f = val; + ((GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity()).value1s = valie1tb.getText(); + + NetworkDispatcher.INSTANCE.sendToServer(new TextParametersMessage.ParametersTextUpdate( + (GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity())); + } + } catch (Exception e) { + valie1tb.setText(((GT_MetaTileEntity_Hatch_ParamText) ((GT_Container_ParamText) mContainer).mTileEntity.getMetaTileEntity()).value1s); + } + } + } + + public void setTextIn0(String in0) { + ((GT_Container_ParamText) mContainer).value0s = in0; + this.value0tb.setText(in0); + } + + public void setTextIn1(String in1) { + ((GT_Container_ParamText) mContainer).value1s = in1; + this.valie1tb.setText(in1); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 30ee7c4d64..972f44fd85 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -21,6 +21,8 @@ import static com.github.technus.tectech.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_INGOT_MASS_DIFF; +import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_decay.URANIUM_MASS_TO_EU_INSTANT; import static gregtech.api.enums.GT_Values.E; /** @@ -30,6 +32,11 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; + private static final double NEUTRONIUM_BLOCK_MASS =4.1E17; + private static final double NEUTRONIUM_BLOCK_ATOM_COUNT =2.4478671E44; + private static final double NEUTRONIUM_BLOCK_TO_EU_INSTANT = URANIUM_MASS_TO_EU_INSTANT * NEUTRONIUM_BLOCK_MASS /(URANIUM_INGOT_MASS_DIFF * 1.78266191e-36);//~ 5.314e40 + private static final double NEUTRON_TO_EU_INSTANT = NEUTRONIUM_BLOCK_TO_EU_INSTANT / NEUTRONIUM_BLOCK_ATOM_COUNT;//~ 0.00021708694 + public boolean glassDome=false; //Time dillatation - to slow down the explosion thing but REALLY REDUCE POWER OUTPUT @@ -190,4 +197,103 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Super unstable!!!" }; } + + /** + * Black hole event horizon radius calculator + * @param massKg mass in kg + * @return radius in meters + */ + private static double getSchwarzschildRadius(double massKg) { + return massKg * 1.48523238761875E-27; + } + + /** + * Black hole event horizon surface area calculator + * @param massKg mass in kg + * @return area in meters^2 + */ + private static double getSchwarzschildArea(double massKg) { + return Math.pow(getSchwarzschildRadius(massKg), 2) * 12.566370614359172; + } + + /** + * Black hole event horizon temperature calculator + * @param massKg mass in kg + * @return temperature in K + */ + private static double getTemperature(double massKg) { + return 2.841438513199716E-9 / (2.3159488515170722E-32 * massKg); + } + + /** + * Black hole luminosity calculator + * @param massKg mass in kg + * @return luminosity in watts + */ + private static double getLuminosity(double massKg) { + return getSchwarzschildArea(massKg) * 5.670373e-8 * Math.pow(getTemperature(massKg), 4); + } + + /** + * Black hole acretion disk luminosity calculator + * @param massKgPer1s mass injection kg per s + * @return luminosity in watts + */ + private static double getAcretionDiskLuminosity(double massKgPer1s) { + return massKgPer1s * 7.48962648947348E15; + } + + /** + * Black hole gravity field calculator, should be used for gravity blasting + * @param massKg mass in kg + * @param distanceSq distance squared in meters + * @return gravity field + */ + private static double getGravityField(double massKg,double distanceSq) { + return massKg * 6.6743015e-11 / distanceSq; + } + + /** + * Black hole containment force calculator + * @param massKg mass in kg + * @param radiusSq radius squared in meters + * @return force in newtons + */ + private static double getContainmentForce(double massKg,double radiusSq) { + return Math.pow(massKg, 2) * 6.6743015e-11 / radiusSq; + } + + /** + * Black hole containment pressure calculator F/s, should be used for bhg initial release explosion? + * @param massKg mass in kg + * @param radiusSq radius squared in meters + * @return pressure in pascals + */ + private static double getContainmentPressure(double massKg,double radiusSq) { + return getContainmentForce(massKg, radiusSq) / (12.566370614359172 * radiusSq); + } + + /** + * Black hole containment energy calculator, assuming F*s, and 100% efficient gravity force field + * @param massKg mass in kg + * @return power in watts + */ + private static double getContainmentPower(double massKg) { + return Math.pow(massKg, 2) * 8.387174624097334E-10; + } + + /** + * Black hole power balance, zero at mass ~= 2.5525e10 (T~=4.8067e12) + * @param massKg mass in kg + * @param massKgPer1s mass injection kg per s + * @return power in watts + */ + @Deprecated + private static double getContainmentPowerBalance(double massKg,double massKgPer1s) { + return getLuminosity(massKg)+getAcretionDiskLuminosity(massKgPer1s)-getContainmentPower(massKg); + } + + //todo compaction energy 8 * Long.MAx_VALUE? + + //todo neutronium decay gen? 0.0007186885 mass diff - actually compute hydrogen amount... } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index 9a4b8021c1..21344b9f34 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -42,9 +42,9 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - private static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10; - private static final double MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; - private static final double MASS_TO_EU_INSTANT= MASS_TO_EU_PARTIAL *20; + public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10; + private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; + public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL *20; //region parameters protected Parameters.Group.ParameterIn ampereFlow; @@ -164,7 +164,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase for(cElementalInstanceStack stack:outputEM[0].values()){ if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) && getBaseMetaTileEntity().decreaseStoredEnergyUnits( - (long) (stack.getEnergySettingCost(1) * MASS_TO_EU_INSTANT), false)) { + (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { stack.setEnergy(1); }else if(!stack.definition.decayMakesEnergy(stack.getEnergy())){ outputEM[0].remove(stack.definition); @@ -175,7 +175,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase float preMass=outputEM[0].getMass(); outputEM[0].tickContent(1,0,1); - double energyDose=((preMass-outputEM[0].getMass())* MASS_TO_EU_PARTIAL); + double energyDose=((preMass-outputEM[0].getMass())* URANIUM_MASS_TO_EU_PARTIAL); eAmpereFlow=(long) ampereFlow.get(); if (eAmpereFlow <= 0) { mEUt=0; -- cgit