Fix possible stack overflow crash when attaching controllers to pipes/blocks of other mods.

This commit is contained in:
Justin Aquadro committed 2015-04-01 17:18:13 -04:00
1 parent aa3a12ea91
commit 1cdd99d1b2
2 files changed
+7 -18

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge'
version = "1.7.10-1.3.5"
version = "1.7.10-1.3.6"
group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "StorageDrawers"
@@ -8,7 +8,6 @@ import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawerGroupInteractive
import com.jaquadro.minecraft.storagedrawers.network.ControllerUpdateMessage;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@@ -70,12 +69,17 @@ public class TileEntityController extends TileEntity implements IDrawerGroup, IS
private int[] autoSides = new int[] { 0, 1 };
private int direction;
private boolean initialized;
private int drawerSize = 0;
private long lastClickTime;
private UUID lastClickUUID;
public TileEntityController () {
invBlockList.add(null);
invSlotList.add(0);
inventorySlots = new int[] { 0 };
}
public int getDirection () {
return direction;
}
@@ -136,21 +140,11 @@ public class TileEntityController extends TileEntity implements IDrawerGroup, IS
drawerSize = 0;
}
//private void buildCache () {
// populateNode(xCoord, yCoord, zCoord, 0);
//}
private void rebuildCache () {
resetCache();
updateCache();
}
private void initialize () {
if (!initialized)
updateCache();
initialized = true;
}
public void updateCache () {
int preCount = inventorySlots.length;
@@ -375,9 +369,6 @@ public class TileEntityController extends TileEntity implements IDrawerGroup, IS
@Override
public int getDrawerCount () {
if (inventorySlots.length == 0)
updateCache();
return drawerSlotList.size();
}
@@ -426,7 +417,6 @@ public class TileEntityController extends TileEntity implements IDrawerGroup, IS
@Override
public int[] getAccessibleSlotsFromSide (int side) {
initialize();
for (int aside : autoSides) {
if (side == aside)
return inventorySlots;
@@ -455,7 +445,6 @@ public class TileEntityController extends TileEntity implements IDrawerGroup, IS
@Override
public int getSizeInventory () {
initialize();
return inventorySlots.length;
}