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 PWR fuel rods not having any radiation value assigned to them
* Fixed trenchmaster helmet not having gas mask protection * Fixed trenchmaster helmet not having gas mask protection
* Fixed large thermobaric artillery rocket still using the wrong slag block * 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; return EnumChatFormatting.RED + "Broken Template" + EnumChatFormatting.RESET;
} }
String s1 = ("" + StatCollector.translateToLocal(out.getUnlocalizedName() + ".name")).trim(); String s1 = out.getDisplayName().trim();
if(s1 != null) { if(s1 != null) {
s = s + " " + s1; s = s + " " + s1;

View File

@ -428,6 +428,11 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null;
int[] access = sided != null ? sided.getAccessibleSlotsFromSide(dir.ordinal()) : null; int[] access = sided != null ? sided.getAccessibleSlotsFromSide(dir.ordinal()) : null;
boolean shouldOutput = true;
while(shouldOutput) {
shouldOutput = false;
outer:
for(int i = 5; i <= 8; i++) { for(int i = 5; i <= 8; i++) {
ItemStack out = slots[i]; ItemStack out = slots[i];
@ -443,10 +448,12 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
ItemStack target = inv.getStackInSlot(slot); ItemStack target = inv.getStackInSlot(slot);
if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize()) { if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < Math.min(target.getMaxStackSize(), inv.getInventoryStackLimit())) {
this.decrStackSize(i, 1); int toDec = Math.min(out.stackSize, Math.min(target.getMaxStackSize(), inv.getInventoryStackLimit()) - target.stackSize);
target.stackSize++; this.decrStackSize(i, toDec);
return; target.stackSize += toDec;
shouldOutput = true;
break outer;
} }
} }
@ -462,7 +469,9 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
copy.stackSize = 1; copy.stackSize = 1;
inv.setInventorySlotContents(slot, copy); inv.setInventorySlotContents(slot, copy);
this.decrStackSize(i, 1); this.decrStackSize(i, 1);
return; shouldOutput = true;
break outer;
}
} }
} }
} }

View File

@ -272,6 +272,10 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null; ISidedInventory sided = inv instanceof ISidedInventory ? (ISidedInventory) inv : null;
int[] access = sided != null ? sided.getAccessibleSlotsFromSide(coord.getDir().ordinal()) : null; int[] access = sided != null ? sided.getAccessibleSlotsFromSide(coord.getDir().ordinal()) : null;
boolean shouldOutput = true;
while(shouldOutput) {
shouldOutput = false;
outer:
for(int i = indices[2]; i <= indices[3]; i++) { for(int i = indices[2]; i <= indices[3]; i++) {
ItemStack out = slots[i]; ItemStack out = slots[i];
@ -288,9 +292,11 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
ItemStack target = inv.getStackInSlot(slot); ItemStack target = inv.getStackInSlot(slot);
if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize() && target.stackSize < inv.getInventoryStackLimit()) { if(InventoryUtil.doesStackDataMatch(out, target) && target.stackSize < target.getMaxStackSize() && target.stackSize < inv.getInventoryStackLimit()) {
this.decrStackSize(i, 1); int toDec = Math.min(out.stackSize, Math.min(target.getMaxStackSize(), inv.getInventoryStackLimit()) - target.stackSize);
target.stackSize++; this.decrStackSize(i, toDec);
return; target.stackSize += toDec;
shouldOutput = true;
break outer;
} }
} }
@ -306,7 +312,9 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
copy.stackSize = 1; copy.stackSize = 1;
inv.setInventorySlotContents(slot, copy); inv.setInventorySlotContents(slot, copy);
this.decrStackSize(i, 1); this.decrStackSize(i, 1);
return; shouldOutput = true;
break outer;
}
} }
} }
} }