Fix unnecessary copies
This commit is contained in:
		| @@ -71,7 +71,7 @@ public class TileConstructor extends TileMachine implements ICompareConfig { | ||||
|             } | ||||
|  | ||||
|             if (block != null && block.canPlaceBlockAt(worldObj, front)) { | ||||
|                 ItemStack took = controller.take(filter.getStackInSlot(0).copy(), compare); | ||||
|                 ItemStack took = controller.take(filter.getStackInSlot(0), compare); | ||||
|  | ||||
|                 if (took != null) { | ||||
|                     scheduler.resetSchedule(); | ||||
|   | ||||
| @@ -63,9 +63,8 @@ public class TileDestructor extends TileMachine implements ICompareConfig, IMode | ||||
|                     worldObj.setBlockToAir(front); | ||||
|  | ||||
|                     for (ItemStack drop : drops) { | ||||
|                         // We check if the controller isn't null here because | ||||
|                         // when a destructor faces a storage network block and removes it | ||||
|                         // it will essentially remove this block from the network without knowing. | ||||
|                         // We check if the controller isn't null here because when a destructor faces a machine block and removes it | ||||
|                         // it will essentially remove this block itself from the network without knowing | ||||
|                         if (controller == null || !controller.push(drop)) { | ||||
|                             InventoryHelper.spawnItemStack(worldObj, front.getX(), front.getY(), front.getZ(), drop); | ||||
|                         } | ||||
|   | ||||
| @@ -43,9 +43,7 @@ public class StorageHandler { | ||||
|             // NO OP, the quantity already set (64) is needed for shift | ||||
|         } | ||||
|  | ||||
|         if (size > stack.getItem().getItemStackLimit(stack)) { | ||||
|             size = stack.getItem().getItemStackLimit(stack); | ||||
|         } | ||||
|         size = Math.min(size, stack.getItem().getItemStackLimit(stack)); | ||||
|  | ||||
|         ItemStack took = controller.take(ItemHandlerHelper.copyStackWithSize(stack, size)); | ||||
|  | ||||
|   | ||||
| @@ -149,7 +149,7 @@ public class TileGrid extends TileMachine implements IGrid { | ||||
|  | ||||
|                     if (slot != null) { | ||||
|                         if (slot.stackSize == 1 && isConnected()) { | ||||
|                             matrix.setInventorySlotContents(i, controller.take(slot.copy())); | ||||
|                             matrix.setInventorySlotContents(i, controller.take(slot)); | ||||
|                         } else { | ||||
|                             matrix.decrStackSize(i, 1); | ||||
|                         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Raoul Van den Berge
					Raoul Van den Berge