faster chemplant ejector

This commit is contained in:
Boblet 2024-01-12 14:20:34 +01:00
parent b548b90bb3
commit 6b34f06324
4 changed files with 81 additions and 63 deletions

View File

@ -19,3 +19,4 @@
* Fixed PWR fuel rods not having any radiation value assigned to them
* Fixed trenchmaster helmet not having gas mask protection
* Fixed large thermobaric artillery rocket still using the wrong slag block
* Fixed some of the assembly templates having broken names due to using the wrong way of translating the output

View File

@ -106,7 +106,7 @@ public class ItemAssemblyTemplate extends Item {
return EnumChatFormatting.RED + "Broken Template" + EnumChatFormatting.RESET;
}
String s1 = ("" + StatCollector.translateToLocal(out.getUnlocalizedName() + ".name")).trim();
String s1 = out.getDisplayName().trim();
if(s1 != null) {
s = s + " " + s1;

View File

@ -428,41 +428,50 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null;
int[] access = sided != null ? sided.getAccessibleSlotsFromSide(dir.ordinal()) : null;
for(int i = 5; i <= 8; i++) {
ItemStack out = slots[i];
if(out != null) {
boolean shouldOutput = true;
while(shouldOutput) {
shouldOutput = false;
outer:
for(int i = 5; i <= 8; i++) {
for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) {
int slot = access != null ? access[j] : j;
ItemStack out = slots[i];
if(out != null) {
if(!inv.isItemValidForSlot(slot, out))
continue;
for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) {
int slot = access != null ? access[j] : j;
ItemStack target = inv.getStackInSlot(slot);
if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize()) {
this.decrStackSize(i, 1);
target.stackSize++;
return;
if(!inv.isItemValidForSlot(slot, out))
continue;
ItemStack target = inv.getStackInSlot(slot);
if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < Math.min(target.getMaxStackSize(), inv.getInventoryStackLimit())) {
int toDec = Math.min(out.stackSize, Math.min(target.getMaxStackSize(), inv.getInventoryStackLimit()) - target.stackSize);
this.decrStackSize(i, toDec);
target.stackSize += toDec;
shouldOutput = true;
break outer;
}
}
}
for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) {
int slot = access != null ? access[j] : j;
if(!inv.isItemValidForSlot(slot, out))
continue;
if(inv.getStackInSlot(slot) == null && (sided != null ? sided.canInsertItem(slot, out, dir.ordinal()) : inv.isItemValidForSlot(slot, out))) {
ItemStack copy = out.copy();
copy.stackSize = 1;
inv.setInventorySlotContents(slot, copy);
this.decrStackSize(i, 1);
return;
for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) {
int slot = access != null ? access[j] : j;
if(!inv.isItemValidForSlot(slot, out))
continue;
if(inv.getStackInSlot(slot) == null && (sided != null ? sided.canInsertItem(slot, out, dir.ordinal()) : inv.isItemValidForSlot(slot, out))) {
ItemStack copy = out.copy();
copy.stackSize = 1;
inv.setInventorySlotContents(slot, copy);
this.decrStackSize(i, 1);
shouldOutput = true;
break outer;
}
}
}
}

View File

@ -271,42 +271,50 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
IInventory inv = (IInventory) te;
ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null;
int[] access = sided != null ? sided.getAccessibleSlotsFromSide(coord.getDir().ordinal()) : null;
for(int i = indices[2]; i <= indices[3]; i++) {
ItemStack out = slots[i];
if(out != null) {
for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) {
int slot = access != null ? access[j] : j;
boolean shouldOutput = true;
while(shouldOutput) {
shouldOutput = false;
outer:
for(int i = indices[2]; i <= indices[3]; i++) {
ItemStack out = slots[i];
if(out != null) {
if(!inv.isItemValidForSlot(slot, out))
continue;
ItemStack target = inv.getStackInSlot(slot);
if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize() && target.stackSize < inv.getInventoryStackLimit()) {
this.decrStackSize(i, 1);
target.stackSize++;
return;
for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) {
int slot = access != null ? access[j] : j;
if(!inv.isItemValidForSlot(slot, out))
continue;
ItemStack target = inv.getStackInSlot(slot);
if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize() && target.stackSize < inv.getInventoryStackLimit()) {
int toDec = Math.min(out.stackSize, Math.min(target.getMaxStackSize(), inv.getInventoryStackLimit()) - target.stackSize);
this.decrStackSize(i, toDec);
target.stackSize += toDec;
shouldOutput = true;
break outer;
}
}
}
for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) {
int slot = access != null ? access[j] : j;
if(!inv.isItemValidForSlot(slot, out))
continue;
if(inv.getStackInSlot(slot) == null && (sided != null ? sided.canInsertItem(slot, out, coord.getDir().ordinal()) : inv.isItemValidForSlot(slot, out))) {
ItemStack copy = out.copy();
copy.stackSize = 1;
inv.setInventorySlotContents(slot, copy);
this.decrStackSize(i, 1);
return;
for(int j = 0; j < (access != null ? access.length : inv.getSizeInventory()); j++) {
int slot = access != null ? access[j] : j;
if(!inv.isItemValidForSlot(slot, out))
continue;
if(inv.getStackInSlot(slot) == null && (sided != null ? sided.canInsertItem(slot, out, coord.getDir().ordinal()) : inv.isItemValidForSlot(slot, out))) {
ItemStack copy = out.copy();
copy.stackSize = 1;
inv.setInventorySlotContents(slot, copy);
this.decrStackSize(i, 1);
shouldOutput = true;
break outer;
}
}
}
}