Adding mellow's nice little helper function

Also includes the conveyor extractor implementing it as a reference
This commit is contained in:
70000hp 2024-06-29 19:28:37 -04:00
parent 4951975d99
commit 1f4ad4bdfe
4 changed files with 20 additions and 12 deletions

View File

@ -52,6 +52,7 @@ public class ContainerBase extends Container {
return var3;
}
/**Used to quickly set up the player inventory*/
public void playerInv(InventoryPlayer invPlayer, int playerInvX, int playerInvY, int playerHotbarY){
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
@ -64,4 +65,17 @@ public class ContainerBase extends Container {
}
}
// I'm gonna make a farken helper function for this shit, why was it done the old way for 9 whole ass years?
//- Mellow, 1884
/**Used to add several conventional inventory slots at a time
* @param inv the inventory to add the slots to
* @param from the slot index to start from*/
public void addSlots(IInventory inv, int from, int x, int y, int rows, int cols) {
int slotSize = 18;
for(int row = 0; row < rows; row++) {
for(int col = 0; col < cols; col++) {
this.addSlotToContainer(new Slot(inv, col + row * cols + from, x + col * slotSize, y + row * slotSize));
}
}
}
}

View File

@ -25,14 +25,16 @@ public class ContainerCraneExtractor extends ContainerBase {
this.addSlotToContainer(new SlotPattern(extractor, j + i * 3, 71 + j * 18, 17 + i * 18));
}
}
/*
//buffer
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 3; j++) {
this.addSlotToContainer(new Slot(extractor, 9 + j + i * 3, 8 + j * 18, 17 + i * 18));
}
}
}*/
addSlots(extractor,9,8,17,3,3);
//upgrades
this.addSlotToContainer(new SlotUpgrade(extractor, 18, 152, 23));
this.addSlotToContainer(new SlotUpgrade(extractor, 19, 152, 47));

View File

@ -31,15 +31,6 @@ public class ContainerCraneGrabber extends ContainerBase {
this.addSlotToContainer(new SlotUpgrade(grabber, 9, 121, 23));
this.addSlotToContainer(new SlotUpgrade(grabber, 10, 121, 47));
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 103 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 161));
}
playerInv(invPlayer, 8, 103, 161);
}

View File

@ -549,6 +549,7 @@ public class Fluids {
//bug meth
metaOrder.add(PHEROMONE);
metaOrder.add(PHEROMONE_M);
metaOrder.add(SLOP);
//ANY INTERNAL RENAMING MUST BE REFLECTED HERE - DON'T FORGET TO CHANGE: LANG FILES + TYPE'S STRING ID + NAME OF TANK/GUI TEXTURE FILES!
// V