mirror of
https://github.com/TicTicBoooom-Mods/MasterfulMachinery.git
synced 2026-03-18 21:40:34 +01:00
jank io
This commit is contained in:
@@ -93,20 +93,9 @@ public class MachinePortBlockEntity extends UpdatableTile implements ITickableTi
|
||||
|
||||
@Override
|
||||
public void receiveMana(int mana) {
|
||||
if (storage instanceof ManaPortStorage) {
|
||||
if (storage instanceof ManaPortStorage && this.isInput()) {
|
||||
ManaPortStorage s = (ManaPortStorage) storage;
|
||||
if (this.isInput()) {
|
||||
s.getInv().receiveMana(mana, false);
|
||||
}
|
||||
else {
|
||||
int tiles = s.getValidPools().size();
|
||||
if (tiles != 0) {
|
||||
int manaForEach = mana / tiles;
|
||||
for (IManaReceiver pool : s.getValidPools()) {
|
||||
pool.receiveMana(manaForEach);
|
||||
}
|
||||
}
|
||||
}
|
||||
s.getInv().receiveMana(mana, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,30 @@ public class ManaPortStorage extends PortStorage {
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(this.validPools);
|
||||
int tiles = validPools.size();
|
||||
if (tiles != 0) {
|
||||
int extractableMana = inv.extractMana(Integer.MAX_VALUE, true);
|
||||
int extractedMana = 0;
|
||||
int filledPools = 0;
|
||||
while (extractableMana != 0) {
|
||||
for (IManaReceiver pool : validPools) {
|
||||
if (!pool.isFull()) {
|
||||
pool.receiveMana(1);
|
||||
extractableMana--;
|
||||
extractedMana++;
|
||||
}
|
||||
else {
|
||||
filledPools++;
|
||||
}
|
||||
}
|
||||
if (filledPools == validPools.size()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
inv.extractMana(extractedMana, false);
|
||||
}
|
||||
|
||||
super.tick(tile);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user