From 1f6d3dca0e73053db3cab4de248832360afe6e55 Mon Sep 17 00:00:00 2001 From: Patrick 'Quezler' Mounier Date: Fri, 3 Jan 2020 17:18:48 +0100 Subject: [PATCH] Give craters surfboards to stream --- .../blocks/distribution/CraterConveyor.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/core/src/mindustry/world/blocks/distribution/CraterConveyor.java b/core/src/mindustry/world/blocks/distribution/CraterConveyor.java index fc78f4e9a2..75caa87c23 100644 --- a/core/src/mindustry/world/blocks/distribution/CraterConveyor.java +++ b/core/src/mindustry/world/blocks/distribution/CraterConveyor.java @@ -15,6 +15,8 @@ import arc.scene.ui.layout.*; import mindustry.world.meta.*; import mindustry.entities.type.*; +import java.io.*; + import static mindustry.Vars.*; public class CraterConveyor extends BaseConveyor{ @@ -154,6 +156,21 @@ public class CraterConveyor extends BaseConveyor{ float lastFrameSpawned = -1; float lastFrameChanged = -1; Crater crater; + + @Override + public void write(DataOutput stream) throws IOException{ + super.write(stream); + + stream.writeBoolean(crater != null); + if(crater != null) crater.write(stream); + } + + @Override + public void read(DataInput stream, byte revision) throws IOException{ + super.read(stream, revision); + + if(stream.readBoolean()) crater = new Crater(stream); + } } protected class Crater implements Position{ @@ -170,6 +187,20 @@ public class CraterConveyor extends BaseConveyor{ face = rotation; } + Crater(DataInput stream) throws IOException{ + rotation = stream.readFloat(); + face = stream.readFloat(); + x = stream.readFloat(); + y = stream.readFloat(); + } + + public void write(DataOutput stream) throws IOException{ + stream.writeFloat(rotation); + stream.writeFloat(face); + stream.writeFloat(x); + stream.writeFloat(y); + } + @Override public float getX(){ return x;