]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Draw village door lines
authorIrtimaled <irtimaled@gmail.com>
Mon, 23 Feb 2015 15:39:53 +0000 (15:39 +0000)
committerIrtimaled <irtimaled@gmail.com>
Mon, 23 Feb 2015 15:39:53 +0000 (15:39 +0000)
Requested by taz4hvn

java/com/irtimaled/bbor/ClientProxy.java
java/com/irtimaled/bbor/ConfigManager.java

index 11855f3386404503f163567dd6a9e9231b781fe3..052dd14ce3b928d97686f32cf54890886c4b0376 100644 (file)
@@ -286,6 +286,8 @@ public class ClientProxy extends CommonProxy {
                             villageBB.getSpawnsIronGolems()) {
                         renderIronGolemSpawnArea(villageBB);
                     }
+                    if(configManager.drawVillageDoors.getBoolean())
+                        renderVillageDoors(villageBB);
                 } else if (bb instanceof BoundingBoxSlimeChunk) {
                     renderSlimeChunk((BoundingBoxSlimeChunk) bb);
                 } else if (bb instanceof BoundingBoxWorldSpawn) {
@@ -356,6 +358,29 @@ public class ClientProxy extends CommonProxy {
         renderCuboid(abb.addCoord(1, 1, 1), villageBB.getColor(), false);
     }
 
+    private void renderVillageDoors(BoundingBoxVillage villageBB) {
+        OffsetPoint center = new OffsetPoint(villageBB.getCenter());
+        Color color = villageBB.getColor();
+        GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
+        Tessellator tessellator = Tessellator.getInstance();
+        WorldRenderer worldRenderer = tessellator.getWorldRenderer();
+
+        int colorR = color.getRed();
+        int colorG = color.getGreen();
+        int colorB = color.getBlue();
+
+        worldRenderer.startDrawing(GL11.GL_LINES);
+        worldRenderer.setColorRGBA(colorR, colorG, colorB, 255);
+        for (BlockPos door : villageBB.getDoors()) {
+            OffsetPoint point = new OffsetPoint(door);
+
+
+            worldRenderer.addVertex(point.getX(), point.getY(), point.getZ());
+            worldRenderer.addVertex(center.getX(), center.getY(), center.getZ());
+        }
+        tessellator.draw();
+    }
+
     private void renderCuboid(AxisAlignedBB aaBB, Color color, boolean fill) {
         aaBB = offsetAxisAlignedBB(aaBB);
         if (fill) {
index a34e65580636a3477947b25267bb6a40872886f4..1dd0d7aecdbbf902febabdbc7717112a2268da5e 100644 (file)
@@ -20,6 +20,7 @@ public class ConfigManager {
     public Setting alwaysVisible;
     public Setting renderVillageAsSphere;
     public Setting drawIronGolemSpawnArea;
+    public Setting drawVillageDoors;
     public Setting drawSlimeChunks;
     public Setting slimeChunkMaxY;
     public Setting keepCacheBetweenSessions;
@@ -40,6 +41,7 @@ public class ConfigManager {
         drawVillages = SetupBooleanProperty(config, "features", "drawVillages", true, "If set to true village bounding boxes are drawn. (default: true)");
         renderVillageAsSphere = SetupBooleanProperty(config, "features", "renderVillageAsSphere", true, "If set to true villages will be drawn as a sphere. (default:true)");
         drawIronGolemSpawnArea = SetupBooleanProperty(config, "features", "drawIronGolemSpawnArea", true, "If set to true the iron golem spawn area of the village will be drawn. (default:true)");
+        drawVillageDoors = SetupBooleanProperty(config, "features", "drawVillageDoors", false, "If set to true lines between the village centre and doors will be drawn. (default:false)");
         drawDesertTemples = SetupBooleanProperty(config, "features", "drawDesertTemples", true, "If set to true desert temple bounding boxes are drawn. (default: true)");
         drawJungleTemples = SetupBooleanProperty(config, "features", "drawJungleTemples", true, "If set to true jungle temple bounding boxes are drawn. (default: true)");
         drawWitchHuts = SetupBooleanProperty(config, "features", "drawWitchHuts", true, "If set to true witch hut bounding boxes are drawn. (default: true)");