aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java69
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java36
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java16
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java6
4 files changed, 124 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java
new file mode 100644
index 0000000000..9a58e74ec4
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java
@@ -0,0 +1,69 @@
+package gtPlusPlus.xmod.gregtech.api.gui.power;
+
+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_Output;
+import gregtech.api.gui.GT_Slot_Render;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicTank;
+
+import java.util.Iterator;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+
+public class CONTAINER_BasicTank extends GT_ContainerMetaTile_Machine {
+ public int mContent = 0;
+
+ public CONTAINER_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 17));
+ this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 1, 80, 53));
+ this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 59, 42));
+ }
+
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) {
+ if (((GTPP_MTE_BasicTank) this.mTileEntity.getMetaTileEntity()).mFluid != null) {
+ this.mContent = ((GTPP_MTE_BasicTank) this.mTileEntity.getMetaTileEntity()).mFluid.amount;
+ } else {
+ this.mContent = 0;
+ }
+
+ Iterator var2 = this.crafters.iterator();
+
+ while (var2.hasNext()) {
+ ICrafting var1 = (ICrafting) var2.next();
+ var1.sendProgressBarUpdate(this, 100, this.mContent & '￿');
+ var1.sendProgressBarUpdate(this, 101, this.mContent >>> 16);
+ }
+
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 100 :
+ this.mContent = this.mContent & -65536 | par2;
+ break;
+ case 101 :
+ this.mContent = this.mContent & '￿' | par2 << 16;
+ }
+
+ }
+
+ public int getSlotCount() {
+ return 2;
+ }
+
+ public int getShiftClickSlotCount() {
+ return 1;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java
new file mode 100644
index 0000000000..a03aac346b
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java
@@ -0,0 +1,36 @@
+package gtPlusPlus.xmod.gregtech.api.gui.power;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Utility;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.StatCollector;
+
+public class GUI_BasicTank extends GT_GUIContainerMetaTile_Machine {
+ private final String mName;
+
+ public GUI_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) {
+ super(new CONTAINER_BasicTank(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/BasicTank.png");
+ this.mName = aName;
+ }
+
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2,
+ 4210752);
+ this.fontRendererObj.drawString(this.mName, 8, 6, 4210752);
+ if (this.mContainer != null) {
+ this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255);
+ this.fontRendererObj.drawString(
+ GT_Utility.parseNumberToString(((CONTAINER_BasicTank) this.mContainer).mContent), 10, 30,
+ 16448255);
+ }
+
+ }
+
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (this.width - this.xSize) / 2;
+ int y = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
index 8e6f36c4af..1ce7fc49d3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
@@ -6,6 +6,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import java.util.Collection;
@@ -70,6 +71,7 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank
}
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ Logger.WARNING("Right Clicked");
if (aBaseMetaTileEntity.isClientSide()) {
return true;
} else {
@@ -175,7 +177,9 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank
}
public boolean isFluidInputAllowed(FluidStack aFluid) {
- return this.getFuelValue(aFluid) > 0;
+ int aVal = this.getFuelValue(aFluid);
+ Logger.WARNING("Fuel Value: "+aVal);
+ return aVal > 0;
}
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
@@ -223,6 +227,7 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank
}
if (aBaseMetaTileEntity.isServerSide()) {
+ Logger.WARNING("Ticking Servside");
aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity
.getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU());
}
@@ -242,6 +247,7 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank
public int getFuelValue(FluidStack aLiquid) {
if (aLiquid != null && this.getRecipes() != null) {
Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList;
+ Logger.WARNING("Fuels: "+tRecipeList.size());
if (tRecipeList != null) {
Iterator var4 = tRecipeList.iterator();
@@ -250,6 +256,13 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank
FluidStack tLiquid;
if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null
&& aLiquid.isFluidEqual(tLiquid)) {
+ Logger.WARNING("Fuel Ok");
+ return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency()
+ * (long) this.consumedFluidPerOperation(tLiquid) / 100L);
+ }
+ if ((tLiquid = tFuel.getRepresentativeFluidInput(0)) != null
+ && aLiquid.isFluidEqual(tLiquid)) {
+ Logger.WARNING("Fuel Ok");
return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency()
* (long) this.consumedFluidPerOperation(tLiquid) / 100L);
}
@@ -264,6 +277,7 @@ public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank
public int getFuelValue(ItemStack aStack) {
if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) {
+ Logger.WARNING("Fuel Item OK");
GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE,
(FluidStack[]) null, new ItemStack[]{aStack});
return tFuel != null ? (int) ((long) tFuel.mSpecialValue * 1000L * (long) this.getEfficiency() / 100L) : 0;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java
index 03c8fadad4..9c6840e33c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java
@@ -6,6 +6,8 @@ import gregtech.api.gui.GT_GUIContainer_BasicTank;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
+import gtPlusPlus.xmod.gregtech.api.gui.power.CONTAINER_BasicTank;
+import gtPlusPlus.xmod.gregtech.api.gui.power.GUI_BasicTank;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -115,12 +117,12 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock {
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity);
+ return new CONTAINER_BasicTank(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ return new GUI_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
}
@Override