Implement outbound queue limits.
Fixes infinite status bar issue. Lowered timer to 5 to make it drain more quickly - makes sense given the production is instant.
This commit is contained in:
committed by
GitHub
parent
2796ab9801
commit
9897e200a8
@@ -37,7 +37,7 @@ public class Crafter extends Block{
|
|||||||
@Override
|
@Override
|
||||||
public void update(Tile tile){
|
public void update(Tile tile){
|
||||||
|
|
||||||
if(tile.entity.timer.get(timerDump, 15) && tile.entity.hasItem(result)){
|
if(tile.entity.timer.get(timerDump, 5) && tile.entity.hasItem(result)){
|
||||||
tryDump(tile, -1, result);
|
tryDump(tile, -1, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,13 @@ public class Crafter extends Block{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// crafter full - it has to be emptied before it can craft again.
|
||||||
|
if(tile.entity.getItem(result) >= capacity)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for(Item item : requirements){
|
for(Item item : requirements){
|
||||||
tile.entity.removeItem(item, 1);
|
tile.entity.removeItem(item, 1);
|
||||||
}
|
}
|
||||||
@@ -67,8 +73,10 @@ public class Crafter extends Block{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawSelect(Tile tile){
|
public void drawSelect(Tile tile){
|
||||||
float fract = (float)tile.entity.totalItems()/((requirements.length-1) *capacity);
|
// each req item has its input buffer + 1 buffer for output.
|
||||||
|
int totalCapacity = (requirements.length + 1) * capacity;
|
||||||
|
float fract = ((float)tile.entity.totalItems())/totalCapacity;
|
||||||
|
|
||||||
Vars.renderer.drawBar(Color.GREEN, tile.worldx(), tile.worldy() + 6, fract);
|
Vars.renderer.drawBar(Color.GREEN, tile.worldx(), tile.worldy() + 6, fract);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user