Added canDump for vaults, better vault icon

This commit is contained in:
Anuken
2018-03-02 09:04:44 -05:00
parent 5faff6260e
commit 827f72f595
6 changed files with 22 additions and 9 deletions

View File

@@ -188,7 +188,7 @@ public class Block{
for(int j = 0; j < nearby.length; j ++){
Tile other = tile.getNearby(nearby[j]);
Tile in = tile.getNearby(Edges.getInsideEdges(width)[j]);
if(other != null && other.block().acceptItem(item, other, in)){
if(other != null && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){
other.block().handleItem(item, other, in);
return;
}
@@ -217,7 +217,7 @@ public class Block{
if(todump != null && item != todump) continue;
if(tile.entity.hasItem(item) && other != null && other.block().acceptItem(item, other, in)){
if(tile.entity.hasItem(item) && other != null && other.block().acceptItem(item, other, in) && canDump(tile, other, item)){
other.block().handleItem(item, other, in);
tile.entity.removeItem(item, 1);
i = (byte)((i + 1) % nearby.length);
@@ -234,6 +234,11 @@ public class Block{
return false;
}
/**Used for dumping items.*/
public boolean canDump(Tile tile, Tile to, Item item){
return true;
}
/**
* Try offloading an item to a nearby container in its facing direction. Returns true if success.
*/

View File

@@ -46,7 +46,8 @@ public class Vault extends Block {
return tile.entity.totalItems() < capacity;
}
boolean canOutput(Tile tile, Tile to){
@Override
public boolean canDump(Tile tile, Tile to, Item item){
return to != null && (to.block() instanceof Vault || to.block() instanceof CoreBlock);
}
}