aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus')
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java45
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_CircuitProgrammer.java64
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_CircuitProgrammer.java4
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java7
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java1
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java12
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java325
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java4
9 files changed, 220 insertions, 244 deletions
diff --git a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java
index e89ccf367f..096d5e7aa1 100644
--- a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java
+++ b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java
@@ -4,7 +4,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
+import gregtech.common.items.GT_MetaGenerated_Tool_01;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@@ -12,6 +12,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
@@ -20,12 +21,16 @@ import net.minecraft.world.World;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.interfaces.ITileTooltip;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.handler.GuiHandler;
import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
+import gtPlusPlus.core.tileentities.general.TileEntityXpConverter;
+import gtPlusPlus.core.util.minecraft.EnchantingUtils;
import gtPlusPlus.core.util.minecraft.InventoryUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
public class CircuitProgrammer extends BlockContainer implements ITileTooltip
{
@@ -63,7 +68,8 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip
@SideOnly(Side.CLIENT)
public IIcon getIcon(final int p_149691_1_, final int p_149691_2_)
{
- return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront));
+ return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (this.textureFront));
+ //return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront));
}
@Override
@@ -85,11 +91,36 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip
if (world.isRemote) {
return true;
}
-
- final TileEntity te = world.getTileEntity(x, y, z);
- if ((te != null) && (te instanceof TileEntityCircuitProgrammer)){
- player.openGui(GTplusplus.instance, GuiHandler.GUI8, world, x, y, z);
- return true;
+ else {
+
+ boolean mDidScrewDriver = false;
+ // Check For Screwdriver
+ try {
+ final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName());
+ final Item mHandItem = mHandStack.getItem();
+ if (((mHandItem instanceof GT_MetaGenerated_Tool_01)
+ && ((mHandItem.getDamage(mHandStack) == 22) || (mHandItem.getDamage(mHandStack) == 150)))) {
+ final TileEntityCircuitProgrammer tile = (TileEntityCircuitProgrammer) world.getTileEntity(x, y, z);
+ if (tile != null) {
+ mDidScrewDriver = tile.onScrewdriverRightClick((byte) side, player, x, y, z);
+ }
+
+ }
+ }
+ catch (final Throwable t) {}
+
+ if (!mDidScrewDriver) {
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if ((te != null) && (te instanceof TileEntityCircuitProgrammer)){
+ player.openGui(GTplusplus.instance, GuiHandler.GUI8, world, x, y, z);
+ Logger.INFO("Opened GUI.");
+ return true;
+ }
+ }
+ else {
+ return true;
+ }
+
}
return false;
}
diff --git a/src/Java/gtPlusPlus/core/container/Container_CircuitProgrammer.java b/src/Java/gtPlusPlus/core/container/Container_CircuitProgrammer.java
index c71fb44b65..88ce3b3b7b 100644
--- a/src/Java/gtPlusPlus/core/container/Container_CircuitProgrammer.java
+++ b/src/Java/gtPlusPlus/core/container/Container_CircuitProgrammer.java
@@ -6,7 +6,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.inventories.InventoryCircuitProgrammer;
import gtPlusPlus.core.slots.SlotIntegratedCircuit;
@@ -23,15 +23,16 @@ public class Container_CircuitProgrammer extends Container {
private final int posY;
private final int posZ;
+ public static final int SLOT_OUTPUT = 25;
+
public static int StorageSlotNumber = 26; // Number of slots in storage area
public static int InventorySlotNumber = 36; // Inventory Slots (Inventory
// and Hotbar)
public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All
// slots
- private final int[] slotStorage = new int[26];
-
public Container_CircuitProgrammer(final InventoryPlayer inventory, final TileEntityCircuitProgrammer te) {
+ Logger.INFO("Created CP Container.");
this.tile_entity = te;
this.inventoryChest = te.getInventory();
@@ -41,32 +42,77 @@ public class Container_CircuitProgrammer extends Container {
this.posX = te.xCoord;
this.posY = te.yCoord;
this.posZ = te.zCoord;
+ Logger.INFO("1");
int o = 0;
// Storage Side
/*for (var6 = 0; var6 < 3; var6++) {
for (var7 = 0; var7 < 5; var7++) {
- this.slotStorage[o] = o;
this.addSlotToContainer(new SlotIntegratedCircuit(o, this.inventoryChest, o, 44 + (var7 * 18), 15 + (var6 * 18)));
o++;
}
}*/
+
+ int xStart = 8;
+ int yStart = 5;
+
+ try {
+ //0
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart, yStart));
+ //1-10
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+18));
+ //11-20
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+18));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+36));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+18, yStart+54));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+36, yStart+54));
+ //21-24
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+54, yStart+54));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+72, yStart+54));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+90, yStart+54));
+ this.addSlotToContainer(new SlotIntegratedCircuit(this.inventoryChest, o++, xStart+108, yStart+54));
+ Logger.INFO("2");
+
//Add Output
- //this.addSlotToContainer(new SlotNoInput(this.inventoryChest, o++, 44 + (6 * 18), 15 + (3 * 18)));
+ this.addSlotToContainer(new SlotNoInput(this.inventoryChest, SLOT_OUTPUT, xStart+(8*18), yStart+54));
+ o++;
+ Logger.INFO("3");
+
+
// Player Inventory
for (var6 = 0; var6 < 3; ++var6) {
for (var7 = 0; var7 < 9; ++var7) {
- this.addSlotToContainer(new Slot(inventory, o++, 8 + (var7 * 18), 84 + (var6 * 18)));
+ 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, o++, 8 + (var6 * 18), 142));
+ this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
+ }
+
+
+
+ Logger.INFO("4");
}
+ catch (Throwable t) {}
}
@@ -89,7 +135,7 @@ public class Container_CircuitProgrammer extends Container {
@Override
public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
- if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockFishTrap) {
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockCircuitProgrammer) {
return false;
}
diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_CircuitProgrammer.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_CircuitProgrammer.java
index 398774c48f..bf49acbb69 100644
--- a/src/Java/gtPlusPlus/core/gui/machine/GUI_CircuitProgrammer.java
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_CircuitProgrammer.java
@@ -8,6 +8,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.container.Container_CircuitProgrammer;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
@@ -19,12 +20,13 @@ public class GUI_CircuitProgrammer extends GuiContainer {
public GUI_CircuitProgrammer(final InventoryPlayer player_inventory, final TileEntityCircuitProgrammer te){
super(new Container_CircuitProgrammer(player_inventory, te));
+ Logger.INFO("Created CP GUI.");
}
@Override
protected void drawGuiContainerForegroundLayer(final int i, final int j){
-
+ super.drawGuiContainerForegroundLayer(i, j);
}
diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index 36acb6d65a..8acb75552c 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -82,6 +82,7 @@ public class GuiHandler implements IGuiHandler {
return new Container_TradeTable(player.inventory, (TileEntityTradeTable)te);
}
else if (ID == GUI8){
+ Logger.INFO("Returning CP Container.");
return new Container_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer)te);
}
}
@@ -134,6 +135,7 @@ public class GuiHandler implements IGuiHandler {
return new GUI_TradeTable(player.inventory, (TileEntityTradeTable)te, ((TileEntityBase) te).getOwner());
}
else if (ID == GUI8){
+ Logger.INFO("Returning CP GUI.");
return new GUI_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer)te);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
index 5cde931822..77689f83aa 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
@@ -18,9 +18,10 @@ public class ItemBlockBasicTile extends ItemBlock{
this.mID = ((ITileTooltip) block).getTooltipID();
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- if (this.mID == 0){ //Fishtrap
+ if (this.mID == 0){ //Fish trap
list.add("This trap catches fish faster if surrounded by more water blocks.");
}
else if (this.mID == 1){ //Modularity
@@ -33,7 +34,9 @@ public class ItemBlockBasicTile extends ItemBlock{
list.add("Scan any crafting recipe in this to mass fabricate them in the Autocrafter..");
}
else if (this.mID == 4){ //Circuit Table
- list.add("Easy Circuit Configuration.");
+ list.add("Easy Circuit Configuration");
+ list.add("Change default setting with a Screwdriver");
+ list.add("Default is used to select slot for auto-insertion");
}
super.addInformation(stack, aPlayer, list, bool);
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java
index f46af5e823..9badd384d8 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTooltip.java
@@ -19,6 +19,7 @@ public class ItemBlockBasicTooltip extends ItemBlock{
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
if (this.mID == 0){ //blockDarkWorldPortalFrame
diff --git a/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java b/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java
index 252f7d398c..c41a385c4b 100644
--- a/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java
+++ b/src/Java/gtPlusPlus/core/slots/SlotIntegratedCircuit.java
@@ -23,9 +23,7 @@ public class SlotIntegratedCircuit extends Slot {
}
else {
mCircuitLock = (short) mTypeLock;
- }
-
-
+ }
}
@Override
@@ -36,8 +34,7 @@ public class SlotIntegratedCircuit extends Slot {
}
if (mCircuitItem != null) {
if (itemstack != null) {
- if (itemstack.getItem() == mCircuitItem) {
-
+ if (itemstack.getItem() == mCircuitItem) {
if (mCircuitLock == -1) {
isValid = true;
}
@@ -45,8 +42,7 @@ public class SlotIntegratedCircuit extends Slot {
if (itemstack.getItemDamage() == mCircuitLock) {
isValid = true;
}
- }
-
+ }
}
}
}
@@ -55,6 +51,6 @@ public class SlotIntegratedCircuit extends Slot {
@Override
public int getSlotStackLimit() {
- return 1;
+ return 64;
}
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java
index 101b2a2c22..0cda40c616 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityCircuitProgrammer.java
@@ -1,42 +1,30 @@
package gtPlusPlus.core.tileentities.general;
-import java.util.Random;
-
-import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.init.Items;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
-
-import gregtech.api.util.GT_Utility;
-
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.inventories.InventoryCircuitProgrammer;
-import gtPlusPlus.core.lib.LoadedMods;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import net.minecraftforge.common.FishingHooks;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInventory {
private int tickCount = 0;
- private boolean isInWater = false;
private final InventoryCircuitProgrammer inventoryContents;
private String customName;
- private int locationX;
- private int locationY;
- private int locationZ;
- private int waterSides = 0;
- private int baseTickRate = 600 * 5;
+ public int locationX;
+ public int locationY;
+ public int locationZ;
+ private int aCurrentMode = 0;
public TileEntityCircuitProgrammer() {
- this.inventoryContents = new InventoryCircuitProgrammer();// number of slots -
- // without product
- // slot
+ this.inventoryContents = new InventoryCircuitProgrammer();
this.setTileLocation();
}
@@ -52,44 +40,16 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv
return false;
}
- public final boolean isSurroundedByWater() {
- this.setTileLocation();
- final Block[] surroundingBlocks = new Block[6];
- if (this.hasWorldObj()) {
- if (!this.getWorldObj().isRemote) {
- surroundingBlocks[0] = this.worldObj.getBlock(this.locationX, this.locationY + 1, this.locationZ); // Above
- surroundingBlocks[1] = this.worldObj.getBlock(this.locationX, this.locationY - 1, this.locationZ); // Below
- surroundingBlocks[2] = this.worldObj.getBlock(this.locationX + 1, this.locationY, this.locationZ);
- surroundingBlocks[3] = this.worldObj.getBlock(this.locationX - 1, this.locationY, this.locationZ);
- surroundingBlocks[4] = this.worldObj.getBlock(this.locationX, this.locationY, this.locationZ + 1);
- surroundingBlocks[5] = this.worldObj.getBlock(this.locationX, this.locationY, this.locationZ - 1);
- int waterCount = 0;
- int trapCount = 0;
- for (final Block checkBlock : surroundingBlocks) {
- if ((checkBlock == Blocks.water) || (checkBlock == Blocks.flowing_water)
- || checkBlock.getUnlocalizedName().toLowerCase().contains("water")
- || (checkBlock == ModBlocks.blockCircuitProgrammer)) {
- if (checkBlock != ModBlocks.blockCircuitProgrammer) {
- waterCount++;
- }
- else {
- waterCount++;
- trapCount++;
- }
- }
- }
- if ((waterCount >= 2) && (trapCount <= 4)) {
- this.waterSides = waterCount;
- return true;
- }
- else if ((waterCount >= 2) && (trapCount > 4)) {
- Logger.WARNING("Too many fish traps surrounding this one.");
- Logger.WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY
- + "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)");
- }
+ //Rename to hasCircuitToConfigure
+ public final boolean hasCircuitToConfigure() {
+ for (ItemStack i : this.getInventory().getInventory()) {
+ if (i == null) {
+ continue;
}
- }
- // Utils.LOG_WARNING("Error finding water");
+ else {
+ return true;
+ }
+ }
return false;
}
@@ -97,165 +57,79 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv
return this.inventoryContents;
}
- public boolean tryAddLoot() {
- if (this.getInventory().getInventory() != null) {
- int checkingSlot = 0;
- final ItemStack loot = this.generateLootForCircuitProgrammer().copy();
- try {
- //Utils.LOG_WARNING("Trying to add "+loot.getDisplayName()+" | "+loot.getItemDamage());
- for (final ItemStack contents : this.getInventory().getInventory()) {
-
-
- if (GT_Utility.areStacksEqual(loot, contents)){
- if (contents.stackSize < contents.getMaxStackSize()) {
- //Utils.LOG_WARNING("3-Trying to add one more "+loot.getDisplayName()+"meta: "+loot.getItemDamage()+" to an existing stack of "+contents.getDisplayName()+" with a size of "+contents.stackSize);
- contents.stackSize++;
- this.markDirty();
- return true;
+ public boolean addOutput() {
+ ItemStack[] aInputs = this.getInventory().getInventory().clone();
+ //Check if there is output in slot.
+ Boolean hasOutput = false;
+ if (aInputs[25] != null) {
+ hasOutput = true;
+ }
+ AutoMap<Integer> aValidSlots = new AutoMap<Integer>();
+ int aSlotCount = 0;
+ for (ItemStack i : aInputs) {
+ if (i != null) {
+ aValidSlots.put(aSlotCount);
+ }
+ aSlotCount++;
+ }
+ for (int e : aValidSlots) {
+ boolean doAdd = false;
+ ItemStack g = this.getStackInSlot(e);
+ int aSize = 0;
+ ItemStack aInputStack = null;
+ if (g != null) {
+ if (!hasOutput) {
+ aSize = g.stackSize;
+ doAdd = true;
+ }
+ else {
+ ItemStack f = this.getStackInSlot(25);
+ if (f != null) {
+ if (f.getItemDamage() == e) {
+ aSize = f.stackSize + g.stackSize;
+ if (aSize > 64) {
+ aInputStack = g.copy();
+ aInputStack.stackSize = (aSize-64);
+ }
+ doAdd = true;
}
}
- checkingSlot++;
- }
- checkingSlot = 0;
- for (final ItemStack contents : this.getInventory().getInventory()) {
- if (contents == null) {
- //Utils.LOG_WARNING("Adding Item To Empty Slot. "+(checkingSlot+1));
- this.getInventory().setInventorySlotContents(checkingSlot, loot);
- this.markDirty();
+ else {
+ doAdd = true;
+ aSize = g.stackSize;
+ }
+ }
+ if (doAdd) {
+ ItemStack aOutput = CI.getNumberedCircuit(e);
+ aOutput.stackSize = aSize;
+ if (aOutput != null) {
+ this.setInventorySlotContents(e, aInputStack);
+ this.setInventorySlotContents(25, aOutput);
return true;
}
- checkingSlot++;
}
}
- catch (final NullPointerException n) {
- }
- }
- this.markDirty();
+ continue;
+ }
return false;
}
- private ItemStack generateLootForCircuitProgrammer() {
- final int lootWeight = MathUtils.randInt(0, 100);
- ItemStack loot;
- if (lootWeight <= 5) {
- loot = ItemUtils.getSimpleStack(Items.slime_ball);
- }
- else if (lootWeight <= 10) {
- loot = ItemUtils.getSimpleStack(Items.bone);
- }
- else if (lootWeight <= 15) {
- loot = ItemUtils.getSimpleStack(Blocks.sand);
- }
- else if (lootWeight <= 20) {
- loot = ItemUtils.simpleMetaStack(Items.dye, 0, 1);
- }
- // Junk Loot
- else if (lootWeight <= 23) {
- if (LoadedMods.PamsHarvestcraft) {
- loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(seaweed, 1);
- }
- else {
- loot = ItemUtils.getSimpleStack(Blocks.dirt);
- }
- }
- // Pam Fish
- else if (lootWeight <= 99) {
- final Random xstr = new Random();
- loot = FishingHooks.getRandomFishable(xstr, 100);
- }
-
- else if (lootWeight == 100){
- final int rareLoot = MathUtils.randInt(1, 10);
- if (rareLoot <= 4) {
- loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nuggetIron", 1);
- if (loot == null){
- loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotIron", 1);
- }
- }
- else if (rareLoot <= 7) {
- loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("nuggetGold", 1);
- if (loot == null){
- loot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotGold", 1);
- }
- }
- else if (rareLoot <= 9){
- loot = ItemUtils.getSimpleStack(Items.emerald);
- }
- else {
- loot = ItemUtils.getSimpleStack(Items.diamond);
- }
- }
- else {
- loot = ItemUtils.getSimpleStack(Blocks.diamond_ore);
- }
- loot.stackSize=1;
- Logger.WARNING("Adding x"+loot.stackSize+" "+loot.getDisplayName()+".");
- return loot;
- }
-
@Override
public void updateEntity() {
try{
if (!this.worldObj.isRemote) {
- this.tickCount++;
- // Utils.LOG_WARNING("Ticking "+this.tickCount);
- // Check if the Tile is within water once per second.
- if ((this.tickCount % 20) == 0) {
- this.isInWater = this.isSurroundedByWater();
- }
- else {
-
- }
-
- if (this.isInWater) {
- this.calculateTickrate();
- }
-
- // Try add some loot once every 30 seconds.
- if ((this.tickCount % this.baseTickRate) == 0) {
- if (this.isInWater) {
- // Add loot
- // Utils.LOG_WARNING("Adding Loot to the fishtrap at
- // x["+this.locationX+"] y["+this.locationY+"]
- // z["+this.locationZ+"] (Ticking for loot every
- // "+this.baseTickRate+" ticks)");
- this.tryAddLoot();
+ if (tickCount % 10 == 0) {
+ if (hasCircuitToConfigure()) {
+ this.addOutput();
this.markDirty();
- }
- else {
- Logger.WARNING("This Trap does not have enough water around it.");
- Logger.WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY
- + "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)");
- this.markDirty();
- }
- this.tickCount = 0;
- }
- if (this.tickCount > (this.baseTickRate + 500)) {
- this.tickCount = 0;
+ }
}
-
- }
+ this.tickCount++;
+ }
}
catch (final Throwable t){}
}
- public void calculateTickrate() {
- int calculateTickrate = 0;
- if (this.waterSides <= 2) {
- calculateTickrate = 0;
- }
- else if ((this.waterSides > 2) && (this.waterSides < 4)) {
- calculateTickrate = 4800;
- }
- else if ((this.waterSides >= 4) && (this.waterSides < 6)) {
- calculateTickrate = 3600;
- }
- else if (this.waterSides == 6) {
- calculateTickrate = 2400;
- }
- this.baseTickRate = calculateTickrate;
- }
-
public boolean anyPlayerInRange() {
return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null;
}
@@ -277,6 +151,7 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv
if (this.hasCustomInventoryName()) {
nbt.setString("CustomName", this.getCustomName());
}
+ nbt.setInteger("aCurrentMode", aCurrentMode);
}
@Override
@@ -287,20 +162,7 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv
if (nbt.hasKey("CustomName", 8)) {
this.setCustomName(nbt.getString("CustomName"));
}
- }
-
- final static String prefix = "food";
- final static String suffix = "raw";
- final static String seaweed = "cropSeaweed";
- final static String greenheartFish = "Greenheartfish";
- private static final String[] harvestcraftFish = { "Anchovy", "Bass", "Carp", "Catfish", "Charr", "Clam", "Crab",
- "Crayfish", "Eel", "Frog", "Grouper", "Herring", "Jellyfish", "Mudfish", "Octopus", "Perch", "Scallop",
- "Shrimp", "Snail", "Snapper", "Tilapia", "Trout", "Tuna", "Turtle", "Walleye" };
-
- public static void pamsHarvestCraftCompat() {
- for (int i = 0; i < harvestcraftFish.length; i++) {
-
- }
+ aCurrentMode = nbt.getInteger("aCurrentMode");
}
@Override
@@ -371,12 +233,12 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv
@Override
public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
- return false;
+ return p_102007_1_ >= 0 && p_102007_1_ <= 24;
}
@Override
public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
- return true;
+ return p_102008_1_ == 25;
}
public String getCustomName() {
@@ -389,7 +251,7 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv
@Override
public String getInventoryName() {
- return this.hasCustomInventoryName() ? this.customName : "container.fishtrap";
+ return this.hasCustomInventoryName() ? this.customName : "container.circuitprogrammer";
}
@Override
@@ -397,4 +259,33 @@ public class TileEntityCircuitProgrammer extends TileEntity implements ISidedInv
return (this.customName != null) && !this.customName.equals("");
}
+ @Override
+ public Packet getDescriptionPacket() {
+ final NBTTagCompound tag = new NBTTagCompound();
+ this.writeToNBT(tag);
+ return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.blockMetadata, tag);
+ }
+
+ @Override
+ public void onDataPacket(final NetworkManager net, final S35PacketUpdateTileEntity pkt) {
+ final NBTTagCompound tag = pkt.func_148857_g();
+ this.readFromNBT(tag);
+ }
+
+ public boolean onScrewdriverRightClick(byte side, EntityPlayer player, int x, int y, int z) {
+ try {
+ if (aCurrentMode == 24) {
+ aCurrentMode = 0;
+ }
+ else {
+ aCurrentMode++;
+ }
+ PlayerUtils.messagePlayer(player, "Now configuring units for type "+aCurrentMode+".");
+ return true;
+ }
+ catch (Throwable t) {
+ return false;
+ }
+ }
+
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java
index 4146602cfc..612defcb89 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java
@@ -109,6 +109,10 @@ extends RenderPlayer {
float aPartialTicks = aEvent.partialRenderTick;
try {
+ if (tResource == null && CORE.DEVENV) {
+ tResource = mCapes[3];
+ }
+
if ((tResource != null) && (!aPlayer.getHideCape())) {
bindTexture(tResource);
GL11.glPushMatrix();