This commit is contained in:
Anuken
2019-09-15 16:54:58 -04:00
parent 681347e933
commit 5ba7e1d08b

View File

@@ -86,21 +86,22 @@ public class CoreBlock extends StorageBlock{
} }
state.teams.get(tile.getTeam()).cores.add(tile); state.teams.get(tile.getTeam()).cores.add(tile);
entity.storageCapacity = entity.proximity().sum(e -> isContainer(e) ? e.block().itemCapacity : 0); entity.storageCapacity = itemCapacity + entity.proximity().sum(e -> isContainer(e) ? e.block().itemCapacity : 0);
entity.proximity().each(this::isContainer, t -> { entity.proximity().each(this::isContainer, t -> {
t.entity.items = entity.items; t.entity.items = entity.items;
t.<StorageBlockEntity>entity().linkedCore = tile; t.<StorageBlockEntity>entity().linkedCore = tile;
}); });
for(Tile other : state.teams.get(tile.getTeam()).cores){ for(Tile other : state.teams.get(tile.getTeam()).cores){
entity.storageCapacity += other.block().itemCapacity; if(other == tile) continue;
entity.storageCapacity += other.block().itemCapacity + other.entity.proximity().sum(e -> isContainer(e) ? e.block().itemCapacity : 0);
} }
for(Item item : content.items()){ for(Item item : content.items()){
entity.items.set(item, Math.min(entity.items.get(item), entity.storageCapacity)); entity.items.set(item, Math.min(entity.items.get(item), entity.storageCapacity));
} }
for(Tile other : state.teams.get(tile.getTeam()).cores){ for(Tile other : state.teams.get(tile.getTeam()).cores){
CoreEntity oe = other.entity(); CoreEntity oe = other.entity();
oe.storageCapacity = entity.storageCapacity; oe.storageCapacity = entity.storageCapacity;
} }