aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/miscutil/core/block/HeliumGenerator.java4
-rw-r--r--src/Java/miscutil/core/gui/ContainerHeliumGenerator.java112
-rw-r--r--src/Java/miscutil/core/gui/GUIHeliumGenerator.java25
-rw-r--r--src/Java/miscutil/core/handler/InvSlotRadiation.java133
-rw-r--r--src/Java/miscutil/core/tileentities/TileEntityHeliumGenerator.java25
5 files changed, 177 insertions, 122 deletions
diff --git a/src/Java/miscutil/core/block/HeliumGenerator.java b/src/Java/miscutil/core/block/HeliumGenerator.java
index da3f3b8041..a90daa03c1 100644
--- a/src/Java/miscutil/core/block/HeliumGenerator.java
+++ b/src/Java/miscutil/core/block/HeliumGenerator.java
@@ -1,5 +1,7 @@
package miscutil.core.block;
+import gregtech.api.enums.Textures;
+
import java.util.Random;
import miscutil.MiscUtils;
@@ -43,7 +45,7 @@ public class HeliumGenerator extends BlockContainer {
{
this.top = iconRegister.registerIcon(CORE.MODID+":blockDefault");
this.sides = iconRegister.registerIcon(CORE.MODID+":blockDefault");
- this.front = iconRegister.registerIcon(CORE.MODID+":blockDefault");
+ this.front = iconRegister.registerIcon(Textures.BlockIcons.MACHINE_CASING_VENT.getTextureFile().getResourcePath());
}
@Override
diff --git a/src/Java/miscutil/core/gui/ContainerHeliumGenerator.java b/src/Java/miscutil/core/gui/ContainerHeliumGenerator.java
index 8acf0313fd..b024e4c5b0 100644
--- a/src/Java/miscutil/core/gui/ContainerHeliumGenerator.java
+++ b/src/Java/miscutil/core/gui/ContainerHeliumGenerator.java
@@ -6,67 +6,71 @@ import ic2.core.slot.SlotInvSlot;
import java.util.List;
import miscutil.core.tileentities.TileEntityHeliumGenerator;
+import miscutil.core.util.Utils;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotFurnace;
public class ContainerHeliumGenerator
- extends ContainerBase<TileEntityHeliumGenerator>
+extends ContainerBase<TileEntityHeliumGenerator>
{
- public short size;
-
- public ContainerHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine)
- {
- super(machine);
- this.addSlotToContainer(new SlotFurnace(player.player, machine, 2, 80, 35));
- this.size = machine.getReactorSize();
- int startX = 16;
- int startY = 16;
- int i = 0;
- for (i = 0; i < 9; i++)
- {
- int x = i % this.size;
- int y = i / this.size;
-
- addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
- }
- startX = 108;
- startY = 16;
- for (i = 9; i < 18; i++)
- {
- int x = i % this.size;
- int y = (i-9) / this.size;
-
- addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
- }
- for (i = 0; i < 3; ++i)
- {
- for (int j = 0; j < 9; ++j)
- {
- this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
- }
- }
+ public short size;
- for (i = 0; i < 9; ++i)
- {
- this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
- }
- // addSlotToContainer(new SlotInvSlot(machine.coolantinputSlot, 0, 8, 25));
- //addSlotToContainer(new SlotInvSlot(machine.hotcoolinputSlot, 0, 188, 25));
- //addSlotToContainer(new SlotInvSlot(machine.coolantoutputSlot, 0, 8, 115));
- //addSlotToContainer(new SlotInvSlot(machine.hotcoolantoutputSlot, 0, 188, 115));
- }
-
- public List<String> getNetworkedFields()
- {
- List<String> ret = super.getNetworkedFields();
-
- ret.add("heat");
- ret.add("maxHeat");
- ret.add("EmitHeat");
- /*ret.add("inputTank");
+ public ContainerHeliumGenerator(InventoryPlayer player, TileEntityHeliumGenerator machine)
+ {
+ super(machine);
+ Utils.LOG_INFO("containerHeliumGenerator");
+ short sr = machine.getReactorSize();
+ this.addSlotToContainer(new SlotFurnace(player.player, machine, 2, 80, 35));
+ this.size = sr;
+ int startX = 16;
+ int startY = 16;
+ int i = 0;
+ for (i = 0; i < 9; i++)
+ {
+ int x = i % this.size;
+ int y = i / this.size;
+
+ addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
+ }
+ startX = 108;
+ startY = 16;
+ for (i = 9; i < 18; i++)
+ {
+ int x = i % this.size;
+ int y = (i-9) / this.size;
+
+ addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ for (int j = 0; j < 9; ++j)
+ {
+ this.addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
+ }
+ }
+
+ for (i = 0; i < 9; ++i)
+ {
+ this.addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
+ }
+ // addSlotToContainer(new SlotInvSlot(machine.coolantinputSlot, 0, 8, 25));
+ //addSlotToContainer(new SlotInvSlot(machine.hotcoolinputSlot, 0, 188, 25));
+ //addSlotToContainer(new SlotInvSlot(machine.coolantoutputSlot, 0, 8, 115));
+ //addSlotToContainer(new SlotInvSlot(machine.hotcoolantoutputSlot, 0, 188, 115));
+ }
+
+ @Override
+ public List<String> getNetworkedFields()
+ {
+ List<String> ret = super.getNetworkedFields();
+
+ ret.add("heat");
+ ret.add("maxHeat");
+ ret.add("EmitHeat");
+ /*ret.add("inputTank");
ret.add("outputTank");
ret.add("fluidcoolreactor");*/
- return ret;
- }
+ return ret;
+ }
} \ No newline at end of file
diff --git a/src/Java/miscutil/core/gui/GUIHeliumGenerator.java b/src/Java/miscutil/core/gui/GUIHeliumGenerator.java
index 8188176c83..dd9c29543b 100644
--- a/src/Java/miscutil/core/gui/GUIHeliumGenerator.java
+++ b/src/Java/miscutil/core/gui/GUIHeliumGenerator.java
@@ -31,6 +31,31 @@ public class GUIHeliumGenerator extends GuiContainer
String s = StatCollector.translateToLocal("container.radiation_collector");
this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
+
+ this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+-1), 80, 35, 2);
+
+ short sr = 3;
+ int size = sr;
+ int startX = 16;
+ int startY = 16;
+ int i = 0;
+ for (i = 0; i < 9; i++)
+ {
+ int x = i % size;
+ int y = i / size;
+ this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752);
+ //addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
+ }
+ startX = 108;
+ startY = 16;
+ for (i = 9; i < 18; i++)
+ {
+ int x = i % size;
+ int y = (i-9) / size;
+ this.fontRendererObj.drawString(StatCollector.translateToLocal("|"+i), startX + 18 * x, startY + 18 * y, 4210752);
+ // addSlotToContainer(new SlotInvSlot(machine.reactorSlot, i, startX + 18 * x, startY + 18 * y));
+ }
+
}
@Override
diff --git a/src/Java/miscutil/core/handler/InvSlotRadiation.java b/src/Java/miscutil/core/handler/InvSlotRadiation.java
index cafb71f00c..8dd918f7e3 100644
--- a/src/Java/miscutil/core/handler/InvSlotRadiation.java
+++ b/src/Java/miscutil/core/handler/InvSlotRadiation.java
@@ -6,68 +6,73 @@ import net.minecraft.item.ItemStack;
public class InvSlotRadiation extends InvSlot
{
- public InvSlotRadiation(TileEntityHeliumGenerator base, String name1, int oldStartIndex1, int count)
- {
- super(base, name1, oldStartIndex1, InvSlot.Access.IO, count);
-
- setStackSizeLimit(1);
- }
-
- public boolean accepts(ItemStack itemStack)
- {
- return ((TileEntityHeliumGenerator)this.base).isUsefulItem(itemStack, true);
- }
-
- public int size()
- {
- return ((TileEntityHeliumGenerator)this.base).getReactorSize() * 6;
- }
-
- public int rawSize()
- {
- return super.size();
- }
-
- public ItemStack get(int index)
- {
- return super.get(mapIndex(index));
- }
-
- public ItemStack get(int x, int y)
- {
- return super.get(y * 9 + x);
- }
-
- public void put(int index, ItemStack content)
- {
- super.put(mapIndex(index), content);
- }
-
- public void put(int x, int y, ItemStack content)
- {
- super.put(y * 9 + x, content);
- }
-
- private int mapIndex(int index)
- {
- int size = size();
- int cols = size / 6;
- if (index < size)
- {
- int row = index / cols;
- int col = index % cols;
-
- return row * 9 + col;
- }
- index -= size;
- int remCols = 9 - cols;
-
- int row = index / remCols;
- int col = cols + index % remCols;
-
- return row * 9 + col;
- }
-
- private final int rows = 6;
- private final int maxCols = 9;
+ public InvSlotRadiation(TileEntityHeliumGenerator base, String name1, int oldStartIndex1, int count)
+ {
+ super(base, name1, oldStartIndex1, InvSlot.Access.IO, count);
+
+ setStackSizeLimit(1);
+ }
+
+ @Override
+ public boolean accepts(ItemStack itemStack)
+ {
+ return ((TileEntityHeliumGenerator)this.base).isUsefulItem(itemStack, true);
+ }
+
+ @Override
+ public int size()
+ {
+ //Utils.LOG_INFO("InvSlotRadiation/Size");
+ return 3 * 6;
+ }
+
+ public int rawSize()
+ {
+ return super.size();
+ }
+
+ @Override
+ public ItemStack get(int index)
+ {
+ return super.get(mapIndex(index));
+ }
+
+ public ItemStack get(int x, int y)
+ {
+ return super.get(y * 9 + x);
+ }
+
+ @Override
+ public void put(int index, ItemStack content)
+ {
+ super.put(mapIndex(index), content);
+ }
+
+ public void put(int x, int y, ItemStack content)
+ {
+ super.put(y * 9 + x, content);
+ }
+
+ private int mapIndex(int index)
+ {
+ int size = size();
+ int cols = size / 6;
+ if (index < size)
+ {
+ int row = index / cols;
+ int col = index % cols;
+
+ return row * 9 + col;
+ }
+ index -= size;
+ int remCols = 9 - cols;
+
+ int row = index / remCols;
+ int col = cols + index % remCols;
+
+ return row * 9 + col;
+ }
+
+ private final int rows = 6;
+ private final int maxCols = 9;
}
diff --git a/src/Java/miscutil/core/tileentities/TileEntityHeliumGenerator.java b/src/Java/miscutil/core/tileentities/TileEntityHeliumGenerator.java
index 5e255f0bbf..dfb98c5c36 100644
--- a/src/Java/miscutil/core/tileentities/TileEntityHeliumGenerator.java
+++ b/src/Java/miscutil/core/tileentities/TileEntityHeliumGenerator.java
@@ -46,6 +46,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
@Override
public void updateEntity(){
+ Utils.LOG_INFO("updateEntity");
if(++progress >= 40){
//if(++progress >= 300){
if(heliumStack == null)
@@ -124,7 +125,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
nbttagcompound.removeTag("Helium");
}
-
+
@Override
public Packet getDescriptionPacket() {
NBTTagCompound tag = new NBTTagCompound();
@@ -152,6 +153,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
@Override
public ItemStack decrStackSize(int slot, int decrement){
+ Utils.LOG_INFO("decrStackSize");
if(heliumStack == null)
return null;
if(decrement < heliumStack.stackSize){
@@ -235,24 +237,30 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
public short getReactorSize()
{
+ //Utils.LOG_INFO("getReactorSize");
if (this.worldObj == null) {
+ Utils.LOG_INFO("getReactorSize == 9");
return 9;
}
short cols = 3;
+ //Utils.LOG_INFO("getReactorSize == "+cols);
for (Direction direction : Direction.directions)
{
TileEntity target = direction.applyToTileEntity(this);
if ((target instanceof TileEntityHeliumGenerator)) {
cols = (short)(cols + 1);
+ Utils.LOG_INFO("getReactorSize =1= "+cols);
}
}
+ //Utils.LOG_INFO("getReactorSize == "+cols);
return cols;
}
protected void updateEntityServer()
{
+ Utils.LOG_INFO("updateEntityServer");
super.updateEntity();
-
+
if (this.updateTicker++ % getTickRate() != 0) {
return;
}
@@ -284,6 +292,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
@Override
public void setActive(boolean active1)
{
+ Utils.LOG_INFO("setActive");
this.active = active1;
if (this.prevActive != active1) {
((NetworkManager)IC2.network.get()).updateTileEntityField(this, "active");
@@ -293,6 +302,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
public void dropAllUnfittingStuff()
{
+ Utils.LOG_INFO("dropAllUnfittingStuff");
for (int i = 0; i < this.reactorSlot.size(); i++)
{
ItemStack stack = this.reactorSlot.get(i);
@@ -313,6 +323,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
public void eject(ItemStack drop)
{
+ Utils.LOG_INFO("eject");
if ((!IC2.platform.isSimulating()) || (drop == null)) {
return;
}
@@ -327,6 +338,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
public boolean isUsefulItem(ItemStack stack, boolean forInsertion)
{
+ Utils.LOG_INFO("isUsefulItem");
Item item = stack.getItem();
if ((forInsertion) && (this.fluidcoolreactor) &&
((item instanceof ItemReactorHeatStorage)) &&
@@ -341,6 +353,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
public boolean calculateHeatEffects()
{
+ Utils.LOG_INFO("calculateHeatEffects");
if ((this.heat < 4000) || (!IC2.platform.isSimulating()) || (ConfigUtil.getFloat(MainConfig.get(), "protection/reactorExplosionPowerLimit") <= 0.0F)) {
return false;
}
@@ -424,6 +437,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
public void processChambers()
{
+ Utils.LOG_INFO("processChambers");
int size = getReactorSize();
for (int pass = 0; pass < 2; pass++) {
for (int y = 0; y < 6; y++) {
@@ -525,6 +539,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
@Override
public ItemStack getItemAt(int x, int y)
{
+ Utils.LOG_INFO("getItemAt");
if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) {
return null;
}
@@ -534,6 +549,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
@Override
public void setItemAt(int x, int y, ItemStack item)
{
+ Utils.LOG_INFO("setItemAt");
if ((x < 0) || (x >= getReactorSize()) || (y < 0) || (y >= 6)) {
return;
}
@@ -542,7 +558,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
public TileEntityHeliumGenerator() {
this.updateTicker = IC2.random.nextInt(getTickRate());
- this.reactorSlot = new InvSlotRadiation(this, "reactor", 0, 54); //TODO
+ this.reactorSlot = new InvSlotRadiation(this, "collector", 0, 54); //TODO
}
@Override
@@ -559,6 +575,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
public boolean receiveredstone()
{
+ Utils.LOG_INFO("receiveRedstone");
if ((this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord)) || (this.redstone)) {
return true;
}
@@ -568,6 +585,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
@Override
public boolean produceEnergy()
{
+ Utils.LOG_INFO("produceEnergy");
return (receiveredstone()) && (ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/generator") > 0.0F);
}
@@ -579,6 +597,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II
@Override
public boolean isFluidCooled() {
+ Utils.LOG_INFO("isFluidCooled");
return false;
}