aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/tileentities/general
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-01-31 03:49:33 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-01-31 03:49:33 +0000
commitc0daba1659c667342da1529c31896a98768a8eda (patch)
treee1e1f25c265c63fb2dbbb5c113e941a92e9cfa4c /src/Java/gtPlusPlus/core/tileentities/general
parent241df1134f16c6c9c54b198db97279d697de8c77 (diff)
downloadGT5-Unofficial-c0daba1659c667342da1529c31896a98768a8eda.tar.gz
GT5-Unofficial-c0daba1659c667342da1529c31896a98768a8eda.tar.bz2
GT5-Unofficial-c0daba1659c667342da1529c31896a98768a8eda.zip
+ Added a config option for control cores. Someone should definitely test this works as expected.
% Reduced cost of Hatch_Control_Core recipe. % Minor tweaks to Fish Traps. $ Fixed inventory shuffling for some Tile Entities. $ Fixed Super Jukebox, it's now mostly functional. $ Fixed constructBaseMetaTileEntity returning the wrong type of Entity for pre-existing wooden pipes, this should now get caught and thrown if the GT++ entity fails to a ClassCastException.
Diffstat (limited to 'src/Java/gtPlusPlus/core/tileentities/general')
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java66
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java38
2 files changed, 24 insertions, 80 deletions
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java
index 63ea1ac783..c184b47d25 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java
@@ -31,10 +31,10 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven
public float prevLidAngle;
/** The number of players currently using this chest */
public int numPlayersUsing;
- private int cachedChestType;
private String customName;
+ private int cachedChestType;
private int tickCount = 0;
public TileEntityDecayablesChest() {
@@ -91,8 +91,9 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven
boolean a1, a2;
int u = 0;
a1 = b.getIsActive(world, iStack);
- a2 = b.tickItemTag(world, iStack);
- while (u < 19) {
+ a2 = false;
+ int SECONDS_TO_PROCESS = 1;
+ while (u < (20 * SECONDS_TO_PROCESS)) {
if (!a1) {
break;
}
@@ -100,7 +101,7 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven
a2 = b.tickItemTag(world, iStack);
u++;
}
- Logger.INFO("| "+b.getUnlocalizedName()+" | "+a1+"/"+a2);
+ Logger.MACHINE_INFO("| "+b.getUnlocalizedName()+" | "+a1+"/"+a2);
if (!a1 && !a2) {
ItemStack replacement = ItemUtils.getSimpleStack(b.getDecayResult());
@@ -352,63 +353,6 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven
ItemUtils.organiseInventory(getInventory());
cachedChestType = 0;
return cachedChestType;
-
-/* //Try merge stacks
- for (int i = 0; i < this.getSizeInventory(); i++) {
- for (int i2 = 0; i2 < this.getSizeInventory(); i2++) {
- if (i != i2) {
- ItemStack[] t1 = new ItemStack[] {this.getStackInSlot(i), this.getStackInSlot(i2)};
- if (t1[0] == null || t1[1] == null) {
- continue;
- }
- else if (!GT_Utility.areStacksEqual(t1[0], t1[1])) {
- continue;
- }
- //Try Merge
- else {
-
- if (GT_Utility.areStacksEqual(t1[0], t1[1])) {
- while ((t1[0].stackSize < 64 && t1[1].stackSize > 0)) {
- t1[0].stackSize++;
- t1[1].stackSize--;
- if (t1[1].stackSize <= 0) {
- t1[1] = null;
- break;
- }
- if (t1[0].stackSize == 64) {
- break;
- }
- }
- this.setInventorySlotContents(i, t1[1]);
- this.setInventorySlotContents(i2, t1[0]);
-
- }
- }
- }
- }
- }
-
- //Move nulls to end
- int count2 = 0;
- for (int i = 0; i < this.getSizeInventory(); i++)
- if (this.getStackInSlot(i) != null)
- this.setInventorySlotContents(count2++, this.getStackInSlot(i));
- while (count2 < this.getSizeInventory())
- this.setInventorySlotContents(count2++, null);
-
- //Sort by name
- int arraySlot = 0;
- HashMap<Integer, Pair<String, ItemStack>> aNameMap = new HashMap<Integer, Pair<String, ItemStack>>();
-
- for (ItemStack ggg : this.inventoryContents.getInventory()) {
- aNameMap.put(arraySlot++, new Pair<String, ItemStack>(ggg != null ? ggg.getDisplayName() : "", ggg));
- }
- arraySlot = 0;
- String[] aNameMapInternal = new String[aNameMap.size()];
- for (Pair pp : aNameMap.values()) {
- aNameMapInternal[arraySlot++] = pp.getKey().toString();
- }
- Arrays.sort(aNameMapInternal); */
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java
index 4220d57de6..e7c37f7994 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java
@@ -80,16 +80,17 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
}
if ((waterCount >= 2) && (trapCount <= 4)) {
this.waterSides = waterCount;
+ Logger.MACHINE_INFO("Valid Trap. "+waterCount+" | "+(this.tickCount/20)+"/"+(this.baseTickRate/20));
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
+ Logger.MACHINE_INFO("Too many fish traps surrounding this one.");
+ Logger.MACHINE_INFO("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY
+ "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)");
}
}
}
- // Utils.LOG_WARNING("Error finding water");
+ // Utils.LOG_MACHINE_INFO("Error finding water");
return false;
}
@@ -103,13 +104,13 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
ItemUtils.organiseInventory(getInventory());
final ItemStack loot = this.generateLootForFishTrap().copy();
try {
- //Utils.LOG_WARNING("Trying to add "+loot.getDisplayName()+" | "+loot.getItemDamage());
+ //Utils.LOG_MACHINE_INFO("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);
+ //Utils.LOG_MACHINE_INFO("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;
@@ -120,7 +121,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
checkingSlot = 0;
for (final ItemStack contents : this.getInventory().getInventory()) {
if (contents == null) {
- //Utils.LOG_WARNING("Adding Item To Empty Slot. "+(checkingSlot+1));
+ //Utils.LOG_MACHINE_INFO("Adding Item To Empty Slot. "+(checkingSlot+1));
this.getInventory().setInventorySlotContents(checkingSlot, loot);
this.markDirty();
return true;
@@ -190,7 +191,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
loot = ItemUtils.getSimpleStack(Blocks.diamond_ore);
}
loot.stackSize=1;
- Logger.WARNING("Adding x"+loot.stackSize+" "+loot.getDisplayName()+".");
+ Logger.MACHINE_INFO("Adding x"+loot.stackSize+" "+loot.getDisplayName()+".");
return loot;
}
@@ -199,7 +200,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
try{
if (!this.worldObj.isRemote) {
this.tickCount++;
- // Utils.LOG_WARNING("Ticking "+this.tickCount);
+ //Logger.MACHINE_INFO("Ticking "+this.tickCount);
// Check if the Tile is within water once per second.
if ((this.tickCount % 20) == 0) {
this.isInWater = this.isSurroundedByWater();
@@ -210,16 +211,13 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
}
// Try add some loot once every 30 seconds.
- if ((this.tickCount % this.baseTickRate) == 0) {
+ if (this.tickCount >= this.baseTickRate) {
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)");
+ Logger.MACHINE_INFO("Adding Loot to the fishtrap at x["+this.locationX+"] y["+this.locationY+"] z["+this.locationZ+"] (Ticking for loot every "+this.baseTickRate+" ticks)");
int aExtraLootChance = MathUtils.randInt(1, 1000);
- if (aExtraLootChance == 1000) {
+ if (aExtraLootChance >= 999) {
this.tryAddLoot();
this.tryAddLoot();
this.tryAddLoot();
@@ -231,11 +229,13 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
this.markDirty();
}
else {
+ Logger.MACHINE_INFO("Not in water.");
this.markDirty();
}
this.tickCount = 0;
}
- if (this.tickCount > (this.baseTickRate + 500)) {
+ if (this.tickCount >= (this.baseTickRate + 500)) {
+ Logger.MACHINE_INFO("Resetting tick counter");
this.tickCount = 0;
}
@@ -246,7 +246,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
public void calculateTickrate() {
int water = this.waterSides;
- int variance = (int) ((MathUtils.randInt(200, 2000)/water)*0.5);
+ //int variance = (int) ((MathUtils.randInt(-200, 200)/water)*0.5);
if (water <= 1) {
this.baseTickRate = 0;
} else if (water == 2) {
@@ -261,7 +261,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
this.baseTickRate = 1750;
}
if (water > 1) {
- this.baseTickRate += variance;
+ //this.baseTickRate += variance;
}
}
@@ -279,7 +279,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
@Override
public void writeToNBT(final NBTTagCompound nbt) {
super.writeToNBT(nbt);
- // Utils.LOG_WARNING("Trying to write NBT data to TE.");
+ // Utils.LOG_MACHINE_INFO("Trying to write NBT data to TE.");
final NBTTagCompound chestData = new NBTTagCompound();
this.inventoryContents.writeToNBT(chestData);
nbt.setTag("ContentsChest", chestData);
@@ -291,7 +291,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory {
@Override
public void readFromNBT(final NBTTagCompound nbt) {
super.readFromNBT(nbt);
- // Utils.LOG_WARNING("Trying to read NBT data from TE.");
+ // Utils.LOG_MACHINE_INFO("Trying to read NBT data from TE.");
this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest"));
if (nbt.hasKey("CustomName", 8)) {
this.setCustomName(nbt.getString("CustomName"));