aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
authorAlkalus <Draknyte1@hotmail.com>2020-05-26 15:14:52 +0100
committerAlkalus <Draknyte1@hotmail.com>2020-05-26 15:14:52 +0100
commit8eb236fd8cc8189ccd0783aa4a6d2fbc48c319e2 (patch)
treec1c0076d14180d9ba836425be0acbf25dd9c5c30 /src/Java/gtPlusPlus/core
parentce84ae027d07500fd91f5b5708d885e4447eceab (diff)
downloadGT5-Unofficial-8eb236fd8cc8189ccd0783aa4a6d2fbc48c319e2.tar.gz
GT5-Unofficial-8eb236fd8cc8189ccd0783aa4a6d2fbc48c319e2.tar.bz2
GT5-Unofficial-8eb236fd8cc8189ccd0783aa4a6d2fbc48c319e2.zip
$ Fixed shaped recipe creation.
$ Minor adjustments to the Volumetric Flask GUI.
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java2
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java125
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java106
-rw-r--r--src/Java/gtPlusPlus/core/gui/widget/GuiValueField.java86
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java2
-rw-r--r--src/Java/gtPlusPlus/core/inventories/Inventory_VolumetricFlaskSetter.java10
-rw-r--r--src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui.java2
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java13
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java25
9 files changed, 245 insertions, 126 deletions
diff --git a/src/Java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java
index 4f86de49d3..36ea2af7cc 100644
--- a/src/Java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java
+++ b/src/Java/gtPlusPlus/core/block/machine/VolumetricFlaskSetter.java
@@ -78,7 +78,7 @@ public class VolumetricFlaskSetter extends BasicTileBlockWithTooltip {
if ((te != null) && (te instanceof TileEntityVolumetricFlaskSetter)){
player.openGui(GTplusplus.instance, GuiHandler.GUI18, world, x, y, z);
TileEntityVolumetricFlaskSetter aTile = (TileEntityVolumetricFlaskSetter) te;
- new Packet_VolumetricFlaskGui2(aTile, aTile.getCustomValue());
+ //new Packet_VolumetricFlaskGui2(aTile, aTile.getCustomValue());
return true;
}
}
diff --git a/src/Java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java
index 5c776b7a57..de3106c957 100644
--- a/src/Java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java
+++ b/src/Java/gtPlusPlus/core/container/Container_VolumetricFlaskSetter.java
@@ -1,22 +1,34 @@
package gtPlusPlus.core.container;
+import java.util.Iterator;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.inventories.Inventory_VolumetricFlaskSetter;
import gtPlusPlus.core.slots.SlotNoInput;
import gtPlusPlus.core.slots.SlotVolumetricFlask;
import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter;
+import gtPlusPlus.core.util.Utils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
+import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class Container_VolumetricFlaskSetter extends Container {
- protected TileEntityVolumetricFlaskSetter tile_entity;
+ public TileEntityVolumetricFlaskSetter mTileEntity;
public final Inventory_VolumetricFlaskSetter inventoryChest;
+
+ public short mCustomValue;
+ private short oCustomValue;
+ private int mTimer;
+
+
private final World worldObj;
private final int posX;
private final int posY;
@@ -26,12 +38,12 @@ public class Container_VolumetricFlaskSetter extends Container {
public static int StorageSlotNumber = 8; // Number of slots in storage area
public static int InventorySlotNumber = 36; // Inventory Slots (Inventory
- // and Hotbar)
+ // and Hotbar)
public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All
- // slots
+ // slots
public Container_VolumetricFlaskSetter(final InventoryPlayer inventory, final TileEntityVolumetricFlaskSetter te) {
- this.tile_entity = te;
+ this.mTileEntity = te;
this.inventoryChest = te.getInventory();
int var6;
@@ -40,6 +52,7 @@ public class Container_VolumetricFlaskSetter extends Container {
this.posX = te.xCoord;
this.posY = te.yCoord;
this.posZ = te.zCoord;
+ //mCustomValue = te.getCustomValue();
int o = 0;
@@ -50,66 +63,50 @@ public class Container_VolumetricFlaskSetter extends Container {
o++;
}
}*/
-
-
+
+
int xStart = 26;
int yStart = 12;
try {
- //0
- this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart, yStart));
- this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
- this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
- this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
- this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
- this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
- this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
- this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart, yStart+18));
-
- //Add Output
- this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, 8+(8*18), 59));
- o++;
-
-
-
- // Player Inventory
- for (var6 = 0; var6 < 3; ++var6) {
- for (var7 = 0; var7 < 9; ++var7) {
- this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18)));
+ //0
+ this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart, yStart));
+ this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
+ this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
+ this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
+ this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
+ this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
+ this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart+=18, yStart));
+ this.addSlotToContainer(new SlotVolumetricFlask(this.inventoryChest, o++, xStart, yStart+18));
+
+ //Add Output
+ this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, 8+(8*18), 59));
+ o++;
+
+
+
+ // Player Inventory
+ for (var6 = 0; var6 < 3; ++var6) {
+ for (var7 = 0; var7 < 9; ++var7) {
+ this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18)));
+ }
}
- }
- // Player Hotbar
- for (var6 = 0; var6 < 9; ++var6) {
- this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
- }
+ // Player Hotbar
+ for (var6 = 0; var6 < 9; ++var6) {
+ this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
+ }
+ detectAndSendChanges();
}
catch (Throwable t) {}
}
- @Override
- public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold,
- final EntityPlayer aPlayer) {
-
- if (!aPlayer.worldObj.isRemote) {
- if ((aSlotIndex == 999) || (aSlotIndex == -999)) {
- // Utils.LOG_WARNING("??? - "+aSlotIndex);
- }
- }
- return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
- }
-
- @Override
- public void onContainerClosed(final EntityPlayer par1EntityPlayer) {
- super.onContainerClosed(par1EntityPlayer);
- }
@Override
public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockVolumetricFlaskSetter) {
return false;
}
-
return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
}
@@ -153,10 +150,36 @@ public class Container_VolumetricFlaskSetter extends Container {
return var3;
}
- // Can merge Slot
@Override
- public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) {
- return super.func_94530_a(p_94530_1_, p_94530_2_);
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if ((Utils.isClient()) || (this.mTileEntity == null)) {
+ return;
+ }
+
+ mCustomValue = mTileEntity.getCustomValue();
+ mTimer++;
+
+ Iterator var2 = this.crafters.iterator();
+ while (var2.hasNext()) {
+ ICrafting var1 = (ICrafting) var2.next();
+ if (mTimer % 20 == 10 || oCustomValue != mCustomValue) {
+ var1.sendProgressBarUpdate(this, 0, mCustomValue);
+ }
+ }
+
+ oCustomValue = mCustomValue;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 0:
+ mCustomValue = (short) par2;
+ break;
+ }
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java
index 6bdf8f2ef5..8df6a8a18e 100644
--- a/src/Java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_VolumetricFlaskSetter.java
@@ -5,8 +5,8 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.container.Container_VolumetricFlaskSetter;
+import gtPlusPlus.core.gui.widget.GuiValueField;
import gtPlusPlus.core.handler.PacketHandler;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.network.packet.Packet_VolumetricFlaskGui;
@@ -14,64 +14,56 @@ import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
-import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
public class GUI_VolumetricFlaskSetter extends GuiContainer {
- private GuiTextField text;
- private TileEntityVolumetricFlaskSetter aTile;
- private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/VolumetricFlaskSetter.png");
+ private GuiTextField mText;
+ private TileEntityVolumetricFlaskSetter mTile;
+ private Container_VolumetricFlaskSetter mContainer;
+ private static final ResourceLocation mGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/VolumetricFlaskSetter.png");
- public GUI_VolumetricFlaskSetter(final InventoryPlayer player_inventory, final TileEntityVolumetricFlaskSetter te){
- super(new Container_VolumetricFlaskSetter(player_inventory, te));
- aTile = te;
- Logger.INFO("Tile Value: "+te.getCustomValue());
+ public GUI_VolumetricFlaskSetter(Container_VolumetricFlaskSetter aContainer){
+ super(aContainer);
+ mContainer = aContainer;
+ mTile = mContainer.mTileEntity;
}
public void initGui(){
super.initGui();
- this.text = new GuiTextField(this.fontRendererObj, this.width / 2 - 62, this.height/2-52, 106, 14);
- text.setMaxStringLength(5);
- if (aTile != null) {
- Logger.INFO("Using Value from Tile: "+aTile.getCustomValue());
- text.setText(""+aTile.getCustomValue());
- }
- else {
- Logger.INFO("Using default Value: 1000");
- text.setText("1000");
- }
- this.text.setFocused(true);
+ this.mText = new GuiValueField(this.fontRendererObj, 26, 31, this.width / 2 - 62, this.height/2-52, 106, 14);
+ mText.setMaxStringLength(5);
+ mText.setText("0");
+ mText.setFocused(true);
}
protected void keyTyped(char par1, int par2){
if (!isNumber(par1) && par2 != Keyboard.KEY_BACK && par2 != Keyboard.KEY_RETURN) {
- text.setFocused(false);
+ mText.setFocused(false);
super.keyTyped(par1, par2);
}
else {
if (par2 == Keyboard.KEY_RETURN) {
- if (text.isFocused()) {
- Logger.INFO("Removing Focus.");
- text.setFocused(false);
+ if (mText.isFocused()) {
+ mText.setFocused(false);
}
}
else if (par2 == Keyboard.KEY_BACK) {
String aCurrentText = getText();
if (aCurrentText.length() > 0) {
- this.text.setText(aCurrentText.substring(0, aCurrentText.length() - 1));
+ this.mText.setText(aCurrentText.substring(0, aCurrentText.length() - 1));
if (getText().length() <= 0) {
- this.text.setText("0");
+ this.mText.setText("0");
}
}
}
else {
- if (this.text.getText().equals("0")) {
- this.text.setText(""+par1);
+ if (this.mText.getText().equals("0")) {
+ this.mText.setText(""+par1);
}
else {
- this.text.textboxKeyTyped(par1, par2);
+ this.mText.textboxKeyTyped(par1, par2);
}
}
sendUpdateToServer();
@@ -80,30 +72,28 @@ public class GUI_VolumetricFlaskSetter extends GuiContainer {
public void updateScreen(){
super.updateScreen();
- this.text.updateCursorCounter();
+ this.mText.updateCursorCounter();
}
public void drawScreen(int par1, int par2, float par3){
this.drawDefaultBackground();
super.drawScreen(par1, par2, par3);
- this.text.drawTextBox();
+
+
}
protected void mouseClicked(int x, int y, int btn) {
super.mouseClicked(x, y, btn);
- this.text.mouseClicked(x, y, btn);
+ this.mText.mouseClicked(x, y, btn);
}
-
-
-
-
@Override
protected void drawGuiContainerForegroundLayer(final int i, final int j){
super.drawGuiContainerForegroundLayer(i, j);
+ this.mText.drawTextBox();
this.fontRendererObj.drawString(I18n.format("container.VolumetricFlaskSetter", new Object[0]), 4, 3, 4210752);
int aYVal = 49;
this.fontRendererObj.drawString(I18n.format("0 = 16l", new Object[0]), 8, aYVal, 4210752);
@@ -114,12 +104,29 @@ public class GUI_VolumetricFlaskSetter extends GuiContainer {
this.fontRendererObj.drawString(I18n.format("6 = 864l", new Object[0]), 64, aYVal, 4210752);
this.fontRendererObj.drawString(I18n.format("3 = 432l", new Object[0]), 8, aYVal+=8, 4210752);
this.fontRendererObj.drawString(I18n.format("-> = Custom", new Object[0]), 59, aYVal, 4210752);
+
+
+ // Check TextBox Value is correct
+ short aCustomValue = 0;
+ if (getText().length() > 0) {
+ try {
+ aCustomValue = Short.parseShort(getText());
+ short aTileValue = ((Container_VolumetricFlaskSetter) mContainer).mCustomValue;
+ if (mContainer != null) {
+ if (aTileValue != aCustomValue){
+ this.mText.setText(""+aTileValue);
+ }
+ }
+ } catch (NumberFormatException ex) {
+
+ }
+ }
}
@Override
protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
- this.mc.renderEngine.bindTexture(craftingTableGuiTextures);
+ this.mc.renderEngine.bindTexture(mGuiTextures);
final int x = (this.width - this.xSize) / 2;
final int y = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
@@ -130,20 +137,19 @@ public class GUI_VolumetricFlaskSetter extends GuiContainer {
}
protected String getText() {
- return this.text.getText();
+ return this.mText.getText();
}
- protected void sendUpdateToServer() {
- Logger.INFO("Trying to send packet to server from GUI.");
- int aCustomValue = 0;
- if (getText().length() > 0)
- try {
- aCustomValue = Integer.parseInt(getText());
- Logger.INFO("Got Value: "+aCustomValue);
- PacketHandler.sendToServer(new Packet_VolumetricFlaskGui(aTile, aCustomValue));
- } catch (NumberFormatException ex) {
-
- }
- }
+ protected void sendUpdateToServer() {
+ short aCustomValue = 0;
+ if (getText().length() > 0) {
+ try {
+ aCustomValue = Short.parseShort(getText());
+ PacketHandler.sendToServer(new Packet_VolumetricFlaskGui(mTile, aCustomValue));
+ } catch (NumberFormatException ex) {
+
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/gui/widget/GuiValueField.java b/src/Java/gtPlusPlus/core/gui/widget/GuiValueField.java
new file mode 100644
index 0000000000..ac4c1a8aee
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/widget/GuiValueField.java
@@ -0,0 +1,86 @@
+package gtPlusPlus.core.gui.widget;
+
+import java.lang.reflect.Field;
+
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiTextField;
+
+public class GuiValueField extends GuiTextField {
+
+ private final FontRenderer mFontRenderer;
+ private final int mScreenLocationX;
+ private final int mScreenLocationY;
+
+ public GuiValueField(FontRenderer aFontRenderer, int aX, int aY, int aScreenLocationX, int aScreenLocationY, int aWidth, int aHeight) {
+ super(aFontRenderer, aX, aY, aWidth, aHeight);
+ mFontRenderer = aFontRenderer;
+ mScreenLocationX = aScreenLocationX;
+ mScreenLocationY = aScreenLocationY;
+ }
+
+ public boolean canLoseFocus() {
+ Field canLoseFocus = ReflectionUtils.getField(GuiTextField.class, "canLoseFocus");
+ if (canLoseFocus != null) {
+ return (boolean) ReflectionUtils.getFieldValue(canLoseFocus, this);
+ }
+ return true;
+ }
+
+ public boolean isFocused() {
+ Field isFocused = ReflectionUtils.getField(GuiTextField.class, "isFocused");
+ if (isFocused != null) {
+ return (boolean) ReflectionUtils.getFieldValue(isFocused, this);
+ }
+ return false;
+ }
+
+ public boolean isBackgroundDrawingEnabled() {
+ Field enableBackgroundDrawing = ReflectionUtils.getField(GuiTextField.class, "enableBackgroundDrawing");
+ if (enableBackgroundDrawing != null) {
+ return (boolean) ReflectionUtils.getFieldValue(enableBackgroundDrawing, this);
+ }
+ return true;
+ }
+ public int getLineScrollOffset() {
+ Field lineScrollOffset = ReflectionUtils.getField(GuiTextField.class, "lineScrollOffset");
+ if (lineScrollOffset != null) {
+ return (int) ReflectionUtils.getFieldValue(lineScrollOffset, this);
+ }
+ return 0;
+ }
+
+ /**
+ * Args: x, y, buttonClicked
+ */
+ public void mouseClicked(int aX, int aY, int aButton){
+
+ boolean flag = aX >= this.mScreenLocationX && aX < this.mScreenLocationX + this.width && aY >= this.mScreenLocationY && aY < this.mScreenLocationY + this.height;
+
+ //Logger.INFO("Clicked X:"+aX);
+ //Logger.INFO("Clicked Y:"+aY);
+ //Logger.INFO("ScreenPos X:"+mScreenLocationX);
+ //Logger.INFO("ScreenPos Y:"+mScreenLocationY);
+ //Logger.INFO("Render X:"+xPosition);
+ //Logger.INFO("Render Y:"+yPosition);
+
+ if (canLoseFocus())
+ {
+ this.setFocused(flag);
+ }
+
+ if (isFocused() && aButton == 0)
+ {
+ int l = aX - this.mScreenLocationX;
+
+ if (isBackgroundDrawingEnabled())
+ {
+ l -= 4;
+ }
+
+ String s = this.mFontRenderer.trimStringToWidth(this.getText().substring(getLineScrollOffset()), this.getWidth());
+ this.setCursorPosition(this.mFontRenderer.trimStringToWidth(s, l).length() + getLineScrollOffset());
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index 827b7d5b8f..0567d6c5dd 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -176,7 +176,7 @@ public class GuiHandler implements IGuiHandler {
} else if (ID == GUI17) {
return new GUI_EggBox(player.inventory, (TileEntityEggBox) te);
} else if (ID == GUI18) {
- return new GUI_VolumetricFlaskSetter(player.inventory, (TileEntityVolumetricFlaskSetter) te);
+ return new GUI_VolumetricFlaskSetter(new Container_VolumetricFlaskSetter(player.inventory, (TileEntityVolumetricFlaskSetter) te));
}
}
diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_VolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/inventories/Inventory_VolumetricFlaskSetter.java
index 9bc9d3aa59..e2dc91a413 100644
--- a/src/Java/gtPlusPlus/core/inventories/Inventory_VolumetricFlaskSetter.java
+++ b/src/Java/gtPlusPlus/core/inventories/Inventory_VolumetricFlaskSetter.java
@@ -1,6 +1,6 @@
package gtPlusPlus.core.inventories;
-import gtPlusPlus.core.slots.SlotIntegratedCircuit;
+import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -9,10 +9,10 @@ import net.minecraft.nbt.NBTTagList;
public class Inventory_VolumetricFlaskSetter implements IInventory{
- private final String name = "Circuit Programmer";
+ private final String name = "Volumetric Flask Setter";
/** Defining your inventory size this way is handy */
- public static final int INV_SIZE = 26;
+ public static final int INV_SIZE = 9;
/** Inventory's size must be same as number of slots you add to the Container class */
private ItemStack[] inventory = new ItemStack[INV_SIZE];
@@ -121,7 +121,7 @@ public class Inventory_VolumetricFlaskSetter implements IInventory{
@Override
public int getInventoryStackLimit()
{
- return 64;
+ return 16;
}
/**
@@ -167,7 +167,7 @@ public class Inventory_VolumetricFlaskSetter implements IInventory{
*/
@Override
public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) {
- return SlotIntegratedCircuit.isItemValidForSlot(itemstack);
+ return VolumetricFlaskHelper.isVolumetricFlask(itemstack);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui.java b/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui.java
index 7f13976d87..609ea729b7 100644
--- a/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui.java
+++ b/src/Java/gtPlusPlus/core/network/packet/Packet_VolumetricFlaskGui.java
@@ -115,7 +115,7 @@ public class Packet_VolumetricFlaskGui extends AbstractServerMessageHandler<Pack
if(te != null) {
Logger.INFO("Setting value on tile. "+message.getCustomValue());
te.setCustomValue(message.getCustomValue());
- return new Packet_VolumetricFlaskGui2(te, message.getCustomValue());
+ //return new Packet_VolumetricFlaskGui2(te, message.getCustomValue());
}
return null;
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java
index 9ca9730330..1aede47096 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java
@@ -4,6 +4,7 @@ import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.container.Container_VolumetricFlaskSetter;
import gtPlusPlus.core.inventories.Inventory_VolumetricFlaskSetter;
+import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper;
import net.minecraft.entity.player.EntityPlayer;
@@ -24,21 +25,21 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide
public int locationY;
public int locationZ;
private int aCurrentMode = 0;
- private int aCustomValue = 1000;
+ private short aCustomValue = 1000;
public TileEntityVolumetricFlaskSetter() {
this.inventoryContents = new Inventory_VolumetricFlaskSetter();
this.setTileLocation();
}
- public int getCustomValue() {
- Logger.INFO("Value: "+this.aCustomValue);
+ public short getCustomValue() {
+ //Logger.INFO("Value: "+this.aCustomValue);
return this.aCustomValue;
}
public void setCustomValue(int aVal) {
Logger.INFO("Old Value: "+this.aCustomValue);
- this.aCustomValue = aVal;
+ this.aCustomValue = (short) MathUtils.balance(aVal, 1, Short.MAX_VALUE);
Logger.INFO("New Value: "+this.aCustomValue);
markDirty();
}
@@ -198,7 +199,7 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide
final NBTTagCompound chestData = new NBTTagCompound();
this.inventoryContents.writeToNBT(chestData);
nbt.setTag("ContentsChest", chestData);
- nbt.setInteger("aCustomValue", aCustomValue);
+ nbt.setShort("aCustomValue", aCustomValue);
if (this.hasCustomInventoryName()) {
nbt.setString("CustomName", this.getCustomName());
}
@@ -210,7 +211,7 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide
super.readFromNBT(nbt);
// Utils.LOG_WARNING("Trying to read NBT data from TE.");
this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest"));
- this.aCustomValue = nbt.getInteger("aCustomValue");
+ this.aCustomValue = nbt.getShort("aCustomValue");
if (nbt.hasKey("CustomName", 8)) {
this.setCustomName(nbt.getString("CustomName"));
}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
index 9c3ea3ab86..a20678c354 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
@@ -693,24 +693,26 @@ public static int mInvalidID = 1;
}
else {
Slots[i] = null;
- Logger.RECIPE("Cleaned a "+o.getClass().getSimpleName()+" from recipe input.");
- Logger.RECIPE("ERROR");
+ Logger.INFO("Cleaned a "+o.getClass().getSimpleName()+" from recipe input.");
+ Logger.INFO("ERROR");
CORE.crash("Bad Shaped Recipe.");
}
}
- Logger.RECIPE("Using String: "+aFullString);
+ Logger.INFO("Using String: "+aFullString);
String aRow1 = aFullString.substring(0, 3);
String aRow2 = aFullString.substring(3, 6);
String aRow3 = aFullString.substring(6, 9);
- Logger.RECIPE(""+aRow1);
- Logger.RECIPE(""+aRow2);
- Logger.RECIPE(""+aRow3);
+ Logger.INFO(""+aRow1);
+ Logger.INFO(""+aRow2);
+ Logger.INFO(""+aRow3);
String[] aStringData = new String[] {aRow1, aRow2, aRow3};
Object[] aDataObject = new Object[19];
aDataObject[0] = aStringData;
int aIndex = 0;
+
+
for (int u=1;u<20;u+=2) {
if (aIndex == 9) {
break;
@@ -718,14 +720,15 @@ public static int mInvalidID = 1;
if (aFullString.charAt(aIndex) != (' ')) {
aDataObject[u] = aFullString.charAt(aIndex);
aDataObject[u+1] = Slots[aIndex];
- Logger.RECIPE("("+aIndex+") "+aFullString.charAt(aIndex)+" | "+ (Slots[aIndex] instanceof ItemStack ? ItemUtils.getItemName((ItemStack) Slots[aIndex]) : Slots[aIndex] instanceof String ? (String) Slots[aIndex] : "Unknown"));
- aIndex++;
+ Logger.INFO("("+aIndex+") "+aFullString.charAt(aIndex)+" | "+ (Slots[aIndex] instanceof ItemStack ? ItemUtils.getItemName((ItemStack) Slots[aIndex]) : Slots[aIndex] instanceof String ? (String) Slots[aIndex] : "Unknown"));
}
+ aIndex++;
}
- Logger.RECIPE("Data Size: "+aDataObject.length);
+ Logger.INFO("Data Size: "+aDataObject.length);
aDataObject = ArrayUtils.removeNulls(aDataObject);
- Logger.RECIPE("Clean Size: "+aDataObject.length);
+ Logger.INFO("Clean Size: "+aDataObject.length);
+ Logger.INFO("ArrayData: "+aDataObject.toString());
ShapedOreRecipe aRecipe = new ShapedOreRecipe(aOutputStack, aDataObject);
@@ -777,7 +780,7 @@ public static int mInvalidID = 1;
GameRegistry.addRecipe(mRecipe);
}
else {
- Logger.RECIPE("[Fix] Invalid shapped recipe outputting "+mOutput != null ? mOutput.getDisplayName() : "Bad Output Item");
+ Logger.INFO("[Fix] Invalid shapped recipe outputting "+mOutput != null ? mOutput.getDisplayName() : "Bad Output Item");
}
}