]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Send door BlockPos with village info
authorIrtimaled <irtimaled@gmail.com>
Mon, 23 Feb 2015 14:00:42 +0000 (14:00 +0000)
committerIrtimaled <irtimaled@gmail.com>
Mon, 23 Feb 2015 14:00:42 +0000 (14:00 +0000)
java/com/irtimaled/bbor/forge/messages/BoundingBoxDeserializer.java
java/com/irtimaled/bbor/forge/messages/BoundingBoxSerializer.java

index 34fc57559bbcf0a89e997edbe44c4ac014230a15..a17c4c44d302e0ad263c3461cfc2aad18f18112b 100644 (file)
@@ -8,6 +8,9 @@ import net.minecraft.util.BlockPos;
 import net.minecraftforge.fml.common.network.ByteBufUtils;
 
 import java.awt.*;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
 
 public class BoundingBoxDeserializer {
     public static BoundingBox deserialize(ByteBuf buf) {
@@ -33,7 +36,12 @@ public class BoundingBoxDeserializer {
         int radius = ByteBufUtils.readVarInt(buf, 5);
         boolean spawnsIronGolems = ByteBufUtils.readVarShort(buf) == 1;
         Color color = new Color(ByteBufUtils.readVarInt(buf, 5));
-        return BoundingBoxVillage.from(center, radius, color, spawnsIronGolems, null);
+        Set<BlockPos> doors = new HashSet<BlockPos>();
+        while (buf.isReadable()) {
+            BlockPos door = deserializeBlockPos(buf);
+            doors.add(door);
+        }
+        return BoundingBoxVillage.from(center, radius, color, spawnsIronGolems, doors);
     }
 
     private static BlockPos deserializeBlockPos(ByteBuf buf) {
index 1db7b52d202cd41960a54d7a6cfbf32705960a4e..5993bc1c48644fb6f72753b8975816400650b49a 100644 (file)
@@ -27,6 +27,10 @@ public class BoundingBoxSerializer {
         ByteBufUtils.writeVarInt(buf, boundingBox.getRadius(), 5);
         ByteBufUtils.writeVarShort(buf, boundingBox.getSpawnsIronGolems() ? 1 : 0);
         serializeColor(boundingBox.getColor(), buf);
+        for(BlockPos door : boundingBox.getDoors())
+        {
+            serializeBlockPos(door, buf);
+        }
     }
 
     private static void serializeStructure(BoundingBoxStructure boundingBox, ByteBuf buf) {