mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-04 22:50:29 +07:00
Fixed error when saving with empty conduits
This commit is contained in:
parent
2c9921748c
commit
8b8172421e
@ -106,13 +106,14 @@ public class Conduit extends Block{
|
||||
|
||||
@Override
|
||||
public void write(DataOutputStream stream) throws IOException{
|
||||
stream.writeByte(liquid.ordinal());
|
||||
stream.writeByte(liquid == null ? -1 : liquid.ordinal());
|
||||
stream.writeByte((byte)(liquidAmount));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(DataInputStream stream) throws IOException{
|
||||
liquid = Liquid.values()[stream.readByte()];
|
||||
byte ordinal = stream.readByte();
|
||||
liquid = ordinal == -1 ? null : Liquid.values()[ordinal];
|
||||
liquidAmount = stream.readByte();
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package io.anuke.mindustry.world.blocks.types;
|
||||
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.Blocks;
|
||||
import io.anuke.ucore.core.Draw;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
|
||||
@ -32,7 +33,8 @@ public class Pump extends Conduit{
|
||||
public void update(Tile tile){
|
||||
ConduitEntity entity = tile.entity();
|
||||
|
||||
if(Timers.get(tile, "pump", 8) && entity.liquidAmount < liquidCapacity){
|
||||
if(tile.floor() == Blocks.water &&
|
||||
Timers.get(tile, "pump", 8) && entity.liquidAmount < liquidCapacity){
|
||||
entity.liquid = Liquid.water;
|
||||
entity.liquidAmount += pumpspeed;
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user