Added canDump for vaults, better vault icon
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user