use of io.anuke.mindustry.world.blocks.types.LiquidBlock in project Mindustry by Anuken.
the class LiquidJunction method handleLiquid.
@Override
public void handleLiquid(Tile tile, Tile source, Liquid liquid, float amount) {
int dir = source.relativeTo(tile.x, tile.y);
dir = (dir + 4) % 4;
Tile to = tile.getNearby(dir);
Timers.run(20f, () -> {
if (to.block() instanceof LiquidBlock && ((LiquidBlock) to.block()).acceptLiquid(to, tile, liquid, amount))
((LiquidBlock) to.block()).handleLiquid(to, tile, liquid, amount);
});
}
use of io.anuke.mindustry.world.blocks.types.LiquidBlock in project Mindustry by Anuken.
the class LiquidJunction method acceptLiquid.
@Override
public boolean acceptLiquid(Tile dest, Tile source, Liquid liquid, float amount) {
int dir = source.relativeTo(dest.x, dest.y);
dir = (dir + 4) % 4;
Tile to = dest.getNearby(dir);
return to != null && to.block() instanceof LiquidBlock && ((LiquidBlock) to.block()).acceptLiquid(to, dest, liquid, amount);
}
Aggregations