Upon clicking on a chunk in MeanTime overlay, the client receive a list of entities for this chunk.

Added a ISerializable interface to make it easier to send/receive complex packets.
This commit is contained in:
ProfMobius committed 2013-10-29 17:48:41 +01:00
1 parent f9fb81aa26
commit f49abc3ecb
10 files changed
+186 -22

No files matched your search

+20 -2
View File
@@ -1,8 +1,12 @@
package mcp.mobius.opis.data;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.tileentity.TileEntity;
public final class CoordinatesBlock {
public final class CoordinatesBlock implements ISerializable {
public final int dim, x, y, z;
public final int chunkX, chunkZ;
//public boolean isChunk;
@@ -69,5 +73,19 @@ public final class CoordinatesBlock {
// return String.format("%s %s %s", this.dim, this.chunkX, this.chunkZ).hashCode();
//else
return String.format("%s %s %s %s", this.dim, this.x, this.y, this.z).hashCode();
};
}
@Override
public void writeToStream(DataOutputStream stream) throws IOException {
stream.writeInt(this.dim);
stream.writeInt(this.x);
stream.writeInt(this.y);
stream.writeInt(this.z);
}
public static CoordinatesBlock readFromStream(DataInputStream stream) throws IOException {
return new CoordinatesBlock(stream.readInt(), stream.readInt(), stream.readInt(), stream.readInt());
}
}