This commit is contained in:
Anuken
2024-11-25 14:13:55 -05:00
parent 650d008fcc
commit 7056ff1fc5

View File

@ -733,15 +733,14 @@ public class CoreBlock extends StorageBlock{
@Override @Override
public void onRemoved(){ public void onRemoved(){
int total = proximity.count(e -> e.items != null && e.items == items); int totalCapacity = proximity.sum(e -> e.items != null && e.items == items ? e.block.itemCapacity : 0);
float fract = 1f / total / state.teams.cores(team).size;
proximity.each(e -> owns(e) && e.items == items && owns(e), t -> { proximity.each(e -> owns(e) && e.items == items && owns(e), t -> {
StorageBuild ent = (StorageBuild)t; StorageBuild ent = (StorageBuild)t;
ent.linkedCore = null; ent.linkedCore = null;
ent.items = new ItemModule(); ent.items = new ItemModule();
for(Item item : content.items()){ for(Item item : content.items()){
ent.items.set(item, (int)(fract * items.get(item))); ent.items.set(item, (int)Math.min(ent.block.itemCapacity, items.get(item) * (float)ent.block.itemCapacity / totalCapacity));
} }
}); });