]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Add initial 1.10 vanilla support 1.0.0-beta12
authorirtimaled <irtimaled@gmail.com>
Wed, 24 Aug 2016 18:31:51 +0000 (19:31 +0100)
committerirtimaled <irtimaled@gmail.com>
Wed, 24 Aug 2016 21:43:35 +0000 (22:43 +0100)
README.md
java/com/irtimaled/bbor/BoundingBox.java
java/com/irtimaled/bbor/BoundingBoxSlimeChunk.java
java/com/irtimaled/bbor/BoundingBoxStructure.java
java/com/irtimaled/bbor/BoundingBoxVillage.java
java/com/irtimaled/bbor/BoundingBoxWorldSpawn.java
java/com/irtimaled/bbor/ClientProxy.java
java/com/irtimaled/bbor/CommonProxy.java
java/com/irtimaled/bbor/ConfigManager.java
java/com/irtimaled/bbor/DimensionProcessor.java
java/com/irtimaled/bbor/StructureType.java

index 501aa3ef89131a4665f300ddeeb829a1018cc742..7818cbbbc7997bfbb548a86edc8c330e7109f1fb 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # BoundingBoxOutlineReloaded
 
-BoundingBoxOutlineReloaded is a mod for Minecraft Forge 1.8 and Vanilla 1.8.1, 1.8 & 1.7.10.
+BoundingBoxOutlineReloaded is a mod for Minecraft 1.10 Vanilla
 
 # Why did I make it?
 
@@ -16,6 +16,7 @@ This mod highlights in a variety of colours and styles the different structures
 - Desert Temples; orange boxes envelop the pyramid and towers. Go grab some loot but beware TNT boobie traps!
 - Jungle Temples; green boxes surround the temple. Indianna Jones would've love these!
 - Ocean Monuments; cyan boxes indicate where guardians spawn. New sea lantern and prismarine block types FTW.
+- End Cities; magenta boxes show the rooms, corridors and air ships in the End. Time to fall with style!
 - Strongholds; yellow boxes show each room in the stronghold. Does anyone make anything with silverfish spawners?
 - Mine Shafts; light gray boxes illustrate each of the mine shafts. Cobwebs... grrr!
 - Villages; multicoloured spheres encircle  the village, with boxes marking if and where iron golems will spawn. You should see the iron titan... CRAZY!
@@ -26,11 +27,7 @@ This mod highlights in a variety of colours and styles the different structures
 
 As chunks are loaded the game provides metadata about all the different structures & features in those chunks.  The mod interprets this meta data, caches the results, and renders the bounding boxes to the screen.  In an SMP environment this data is not present on the clients so the mod needs to run on the server where the processing happens and then the relevant metadata is sent to the clients for them to render.
 
-# Installing (Forge)
-
-Make sure you have Forge 1.8 installed then drop the jar file into the mods/1.8 folder.  Remember this will need to be installed on client and server in an SMP scenario (unless you use local dat files - see below)
-
-# Installing (Vanilla)
+# Installing
 
 Copy the contents of the Vanilla archive into the JAR file as per usual.  In a SMP scenario you'll need to use local dat files - see below.
 
@@ -47,6 +44,7 @@ Witch Huts | Both | Process/Render Witch Huts | drawWitchHuts | true/false | tru
 Desert Temples | Both | Process/Render Desert Temples | drawDesertTemples | true/false | true
 Jungle Temples | Both | Process/Render Jungle Temples | drawJungleTemples | true/false | true
 Ocean Monuments | Both | Process/Render Ocean Monuments | drawOceanMonuments | true/false | true
+End Cities | Both | Process/Render End Cities | drawEndCities | true/false | true
 Strongholds | Both | Process/Render Strongholds | drawStrongholds | true/false | false
 Mine Shafts | Both | Process/Render Mine Shafts | drawMineShafts | true/false | false
 Villages | Both | Process/Render Villages | drawVillages | true/false | true
@@ -71,15 +69,17 @@ Open the config/BBOutlineReloaded.cfg file with your text editor of choice and c
 # Using
 
 Press B, sit back and enjoy the goodness flowing onto your screen.
+Press O to switch the "Display Outer Boxes Only" mode on and off, this will allow you to see the full boundary of Nether Fortresses, End Cities, Strongholds and Mineshafts
 
 # Using with vanilla servers
 
 There are two options when you want bounding boxes to show whilst accessing vanilla servers:-
 
 1. Keep cache - With the "Keep Cache Between Sessions" config setting enabled, Open a copy of the world in single player and move around to capture all the structures you want in the cache. Once you are happy with the structures you have cached, quit the single player game and connect to the server without closing Minecraft.  You will see all the structures from the cache.
-2. Load dat files - Copy the dat files listed below into config/BBOutlineReloaded/{host},{port} and these will be loaded when you connect to the vanilla server.  {host} is the name or ip you use to connect to the server; {port} is the port you specify when connecting.  The mod will load any/all of following files:-
+2. Load dat files - Copy the dat files listed below into config/BBOutlineReloaded/{host}/{port} and these will be loaded when you connect to the vanilla server.  {host} is the name or ip you use to connect to the server; {port} is the port you specify when connecting.  The mod will load any/all of following files:-
   - level.dat; include this for world spawn, spawn and slime chunks to be rendered.
   - Fortress.dat; include this for Nether Fortresses to be rendered.
+  - EndCities.dat; include this for EndCities to be rendered.
   - Mineshaft.dat; include this for Mineshafts to be rendered.
   - Monument.dat; include this for Ocean Monuments to be rendered.
   - Stronghold.dat; include this for Strongholds to be rendered.
@@ -88,6 +88,5 @@ There are two options when you want bounding boxes to show whilst accessing vani
   It is also possible to include the villages.dat, villages_end.dat & villages_nether.dat files and it will render villages however these files only contain the villages that were loaded when the files were copied and will not handle any changes that occur with villages such as when doors are added/removed or villager population changes.
 
 # Links
-- Forge 1.8 - [Download](http://files.minecraftforge.net/minecraftforge/1.8)
 - 4poc's BBOutline mod - [Forum](http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1286555-bounding-box-outline) | [Source](http://www.github.com/4poc/bboutline)
 - KaboPC's VillageMarker mod - [Forum](http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1288327-village-marker-mod)
index ab416f64ab476c8a18f6f8c634c00381a7d2320c..198ee323ae6fee1f9ea7fb081c4feee8db7c9753 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor;
 
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
 
 import java.awt.*;
 
@@ -51,12 +51,7 @@ public abstract class BoundingBox {
     }
 
     public AxisAlignedBB toAxisAlignedBB(boolean extendMaxByOne) {
-        AxisAlignedBB axisAlignedBB = AxisAlignedBB.fromBounds(minBlockPos.getX(),
-                minBlockPos.getY(),
-                minBlockPos.getZ(),
-                maxBlockPos.getX(),
-                maxBlockPos.getY(),
-                maxBlockPos.getZ());
+        AxisAlignedBB axisAlignedBB = new AxisAlignedBB(minBlockPos, maxBlockPos);
         if (extendMaxByOne)
             return axisAlignedBB.addCoord(1, 1, 1);
         return axisAlignedBB;
index 543635986726df27a39b32b3ed4ae0b56dfa1fdc..b5418f578e7e6313666c81cefa4659390a9a97bb 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor;
 
-import net.minecraft.util.BlockPos;
-import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.ChunkPos;
 
 import java.awt.*;
 
@@ -10,7 +10,7 @@ public class BoundingBoxSlimeChunk extends BoundingBox {
         super(minBlockPos, maxBlockPos, color);
     }
 
-    public static BoundingBoxSlimeChunk from(ChunkCoordIntPair chunkCoordIntPair, Color color) {
+    public static BoundingBoxSlimeChunk from(ChunkPos chunkCoordIntPair, Color color) {
         BlockPos minBlockPos = new BlockPos(chunkCoordIntPair.getXStart(), 1, chunkCoordIntPair.getZStart());
         BlockPos maxBlockPos = new BlockPos(chunkCoordIntPair.getXEnd(), 38, chunkCoordIntPair.getZEnd());
         return new BoundingBoxSlimeChunk(minBlockPos, maxBlockPos, color);
index 597957ce9776334cfff4b35ea420e49e51ef6bc9..63b2c0529b7457e90ab7c9fe15cc5c3464350114 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor;
 
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.gen.structure.StructureBoundingBox;
 
 import java.awt.*;
index a617e509c46c22206c66ac506bfc2e1f11862b59..97ab1e1a18e80a0b766920b0661e3c55a51038d4 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor;
 
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
 
 import java.awt.*;
 import java.util.Set;
index 2c06c8abb0ee8e927de8ae78ab60cfe4cb1f09b5..ef7d11103a7ac0e790368810d9a797436cd349e0 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor;
 
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
 
 import java.awt.*;
 
index e920affe5862a96337aac674e7d4c20594014a61..c192e1e6def1e6cdf5626aae48b29a56e633169a 100644 (file)
@@ -1,18 +1,20 @@
 package com.irtimaled.bbor;
 
 import net.minecraft.client.Minecraft;
+import net.minecraft.client.multiplayer.WorldClient;
 import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.WorldRenderer;
+import net.minecraft.client.renderer.VertexBuffer;
+import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
 import net.minecraft.client.settings.KeyBinding;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.nbt.CompressedStreamTools;
 import net.minecraft.nbt.NBTTagCompound;
 import net.minecraft.nbt.NBTTagList;
 import net.minecraft.network.NetworkManager;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.BlockPos;
-import net.minecraft.world.ChunkCoordIntPair;
-import net.minecraft.world.World;
+import net.minecraft.util.math.AxisAlignedBB;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.ChunkPos;
+import net.minecraft.world.DimensionType;
 import org.apache.commons.lang3.ArrayUtils;
 import org.lwjgl.input.Keyboard;
 import org.lwjgl.opengl.GL11;
@@ -32,7 +34,9 @@ public class ClientProxy extends CommonProxy {
 
     private double activeY;
     private boolean active;
-    private KeyBinding hotKey;
+    private boolean outerBoxOnly;
+    private KeyBinding activeHotKey;
+    private KeyBinding outerBoxOnlyHotKey;
     private double playerX;
     private double playerY;
     private double playerZ;
@@ -41,18 +45,23 @@ public class ClientProxy extends CommonProxy {
     private BoundingBox lazySpawnChunksBoundingBox;
 
     public void keyPressed() {
-        if (hotKey.isPressed()) {
+        if (activeHotKey.isPressed()) {
             active = !active;
             if (active)
                 activeY = playerY;
+        } else
+        if(outerBoxOnlyHotKey.isPressed()){
+            outerBoxOnly = !outerBoxOnly;
         }
     }
 
     @Override
     public void init(ConfigManager configManager) {
         super.init(configManager);
-        hotKey = new KeyBinding("Toggle On/Off", Keyboard.KEY_B, "Bounding Box Outline Reloaded");
-        Minecraft.getMinecraft().gameSettings.keyBindings = ArrayUtils.add(Minecraft.getMinecraft().gameSettings.keyBindings, hotKey);
+        String category = "Bounding Box Outline Reloaded";
+        activeHotKey = new KeyBinding("Toggle On/Off", Keyboard.KEY_B, category);
+        outerBoxOnlyHotKey = new KeyBinding("Toggle Display Outer Box Only", Keyboard.KEY_O, category);
+        Minecraft.getMinecraft().gameSettings.keyBindings = ArrayUtils.addAll(Minecraft.getMinecraft().gameSettings.keyBindings, activeHotKey, outerBoxOnlyHotKey);
     }
 
     @Override
@@ -70,9 +79,9 @@ public class ClientProxy extends CommonProxy {
         playerZ = entityPlayer.lastTickPosZ + (entityPlayer.posZ - entityPlayer.lastTickPosZ) * (double) partialTicks;
 
         if (this.active) {
-            int activeDimensionId = entityPlayer.worldObj.provider.getDimensionId();
-            if (boundingBoxCacheMap.containsKey(activeDimensionId)) {
-                renderBoundingBoxes(boundingBoxCacheMap.get(activeDimensionId).getBoundingBoxes());
+            DimensionType dimensionType = entityPlayer.worldObj.provider.getDimensionType();
+            if (boundingBoxCacheMap.containsKey(dimensionType)) {
+                renderBoundingBoxes(boundingBoxCacheMap.get(dimensionType).getBoundingBoxes());
             }
         }
     }
@@ -87,16 +96,16 @@ public class ClientProxy extends CommonProxy {
 
     private void loadLocalStructures(String host, int port) {
         Logger.info("Looking for local structures (host:port=%s:%d)", host, port);
-        String path = String.format("BBOutlineReloaded%s%s", File.separator, host);
+        String path = String.format("BBOutlineReloaded%s%s%s%d", File.separator, host, File.separator, port);
         File localStructuresFolder = new File(configManager.configDir, path);
         Logger.info("Looking for local structures (folder=%s)", localStructuresFolder.getAbsolutePath());
         if (!localStructuresFolder.exists()) {
-            path = String.format("BBOutlineReloaded%s%s,%d", File.separator, host, port);
+            path = String.format("BBOutlineReloaded%s%s", File.separator, host);
             localStructuresFolder = new File(configManager.configDir, path);
             Logger.info("Looking for local structures (folder=%s)", localStructuresFolder.getAbsolutePath());
         }
         if (!localStructuresFolder.exists()) {
-            path = String.format("BBOutlineReloaded%s%s%s%d", File.separator, host, File.separator, port);
+            path = String.format("BBOutlineReloaded%s%s,%d", File.separator, host, port);
             localStructuresFolder = new File(configManager.configDir, path);
             Logger.info("Looking for local structures (folder=%s)", localStructuresFolder.getAbsolutePath());
         }
@@ -134,7 +143,7 @@ public class ClientProxy extends CommonProxy {
             loadVillageNbtFile(localStructuresFolder, cache, "Villages.dat");
         }
 
-        boundingBoxCacheMap.put(0, cache);
+        boundingBoxCacheMap.put(DimensionType.OVERWORLD, cache);
     }
 
     private void loadNetherStructures(File localStructuresFolder) {
@@ -144,7 +153,7 @@ public class ClientProxy extends CommonProxy {
         if (configManager.drawVillages.getBoolean()) {
             loadVillageNbtFile(localStructuresFolder, cache, "villages_nether.dat");
         }
-        boundingBoxCacheMap.put(-1, cache);
+        boundingBoxCacheMap.put(DimensionType.NETHER, cache);
     }
 
     private void loadEndStructures(File localStructuresFolder) {
@@ -152,7 +161,10 @@ public class ClientProxy extends CommonProxy {
         if (configManager.drawVillages.getBoolean()) {
             loadVillageNbtFile(localStructuresFolder, cache, "Villages_end.dat");
         }
-        boundingBoxCacheMap.put(1, cache);
+        if (configManager.drawEndCities.getBoolean()) {
+            loadStructureNbtFile(localStructuresFolder, cache, "EndCity.dat", StructureType.EndCity.getColor(), "*");
+        }
+        boundingBoxCacheMap.put(DimensionType.THE_END, cache);
     }
 
     private void loadVillageNbtFile(File localStructuresFolder, BoundingBoxCache cache, String fileName) {
@@ -264,55 +276,57 @@ public class ClientProxy extends CommonProxy {
         }
 
         for (BoundingBox bb : map.keySet()) {
-            renderBoundingBoxes(map.get(bb));
+            if (outerBoxOnly) {
+                renderBoundingBoxSet(map.get(bb));
+            } else {
+                renderBoundingBoxByType(bb);
+            }
         }
 
-        renderBoundingBoxes(getClientBoundingBoxes());
+        renderBoundingBoxSet(getClientBoundingBoxes());
 
         GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
         GL11.glEnable(GL11.GL_CULL_FACE);
         GL11.glEnable(GL11.GL_TEXTURE_2D);
     }
 
-    private void renderBoundingBoxes(Set<BoundingBox> bbList) {
-        if(bbList == null)
-            return;
-        World world = Minecraft.getMinecraft().theWorld;
-        Set activeChunks = getActiveChunks(world);
+    private void renderBoundingBoxSet(Set<BoundingBox> bbList) {
+        if(bbList != null)
         for (BoundingBox bb : bbList) {
+            renderBoundingBoxByType(bb);
+        }
+    }
 
-            if (activeChunks.contains(world.getChunkFromBlockCoords(bb.getMinBlockPos()).getChunkCoordIntPair()) ||
-                    activeChunks.contains(world.getChunkFromBlockCoords(bb.getMaxBlockPos()).getChunkCoordIntPair())) {
+    private void renderBoundingBoxByType(BoundingBox bb) {
+        WorldClient world = Minecraft.getMinecraft().theWorld;
+        Set<ChunkPos> viewableChunks = world.getViewableChunks();
+        if (!viewableChunks.contains(world.getChunkFromBlockCoords(bb.getMinBlockPos()).getChunkCoordIntPair()) &&
+            !viewableChunks.contains(world.getChunkFromBlockCoords(bb.getMaxBlockPos()).getChunkCoordIntPair())) {
+            return;
+        }
 
-                if (bb instanceof BoundingBoxVillage) {
-                    BoundingBoxVillage villageBB = (BoundingBoxVillage) bb;
-                    if (configManager.renderVillageAsSphere.getBoolean()) {
-                        renderBoundingBoxVillageAsSphere(villageBB);
-                    } else {
-                        renderBoundingBox(villageBB);
-                    }
-                    if (configManager.drawIronGolemSpawnArea.getBoolean() &&
-                            villageBB.getSpawnsIronGolems()) {
-                        renderIronGolemSpawnArea(villageBB);
-                    }
-                    if(configManager.drawVillageDoors.getBoolean())
-                        renderVillageDoors(villageBB);
-                } else if (bb instanceof BoundingBoxSlimeChunk) {
-                    renderSlimeChunk((BoundingBoxSlimeChunk) bb);
-                } else if (bb instanceof BoundingBoxWorldSpawn) {
-                    renderWorldSpawn((BoundingBoxWorldSpawn) bb);
-
-                } else {
-                    renderBoundingBox(bb);
-                }
+        if (bb instanceof BoundingBoxVillage) {
+            BoundingBoxVillage villageBB = (BoundingBoxVillage) bb;
+            if (configManager.renderVillageAsSphere.getBoolean()) {
+                renderBoundingBoxVillageAsSphere(villageBB);
+            } else {
+                renderBoundingBox(villageBB);
+            }
+            if (configManager.drawIronGolemSpawnArea.getBoolean() &&
+                    villageBB.getSpawnsIronGolems()) {
+                renderIronGolemSpawnArea(villageBB);
             }
+            if(configManager.drawVillageDoors.getBoolean())
+                renderVillageDoors(villageBB);
+        } else if (bb instanceof BoundingBoxSlimeChunk) {
+            renderSlimeChunk((BoundingBoxSlimeChunk) bb);
+        } else if (bb instanceof BoundingBoxWorldSpawn) {
+            renderWorldSpawn((BoundingBoxWorldSpawn) bb);
+        } else {
+            renderBoundingBox(bb);
         }
     }
 
-    private Set getActiveChunks(World world) {
-        return ReflectionHelper.getPrivateValue(World.class, world, Set.class);
-    }
-
     private void renderBoundingBox(BoundingBox bb) {
         AxisAlignedBB aaBB = bb.toAxisAlignedBB();
         Color color = bb.getColor();
@@ -372,19 +386,18 @@ public class ClientProxy extends CommonProxy {
         Color color = villageBB.getColor();
         GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
         Tessellator tessellator = Tessellator.getInstance();
-        WorldRenderer worldRenderer = tessellator.getWorldRenderer();
+        VertexBuffer worldRenderer = tessellator.getBuffer();
 
         int colorR = color.getRed();
         int colorG = color.getGreen();
         int colorB = color.getBlue();
 
-        worldRenderer.startDrawing(GL11.GL_LINES);
-        worldRenderer.setColorRGBA(colorR, colorG, colorB, 255);
+        worldRenderer.begin(GL11.GL_LINES, worldRenderer.getVertexFormat());
         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());
+            worldRenderer.pos(point.getX(), point.getY(), point.getZ()).color(colorR, colorG, colorB, 255).endVertex();
+            worldRenderer.pos(center.getX(), center.getY(), center.getZ()).color(colorR, colorG, colorB, 255).endVertex();
         }
         tessellator.draw();
     }
@@ -413,45 +426,92 @@ public class ClientProxy extends CommonProxy {
 
     private void renderCuboid(AxisAlignedBB bb, int alphaChannel, Color color) {
         Tessellator tessellator = Tessellator.getInstance();
-        WorldRenderer worldRenderer = tessellator.getWorldRenderer();
+        VertexBuffer worldRenderer = tessellator.getBuffer();
 
         int colorR = color.getRed();
         int colorG = color.getGreen();
         int colorB = color.getBlue();
 
-        worldRenderer.startDrawing(GL11.GL_QUADS);
-        worldRenderer.setColorRGBA(colorR, colorG, colorB, alphaChannel);
-        worldRenderer.addVertex(bb.minX, bb.minY, bb.minZ);
-        worldRenderer.addVertex(bb.maxX, bb.minY, bb.minZ);
-        worldRenderer.addVertex(bb.maxX, bb.minY, bb.maxZ);
-        worldRenderer.addVertex(bb.minX, bb.minY, bb.maxZ);
+        worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
+        worldRenderer.pos(bb.minX, bb.minY, bb.minZ)
+                .color(colorR, colorG, colorB, alphaChannel)
+                .endVertex();
+        worldRenderer.pos(bb.maxX, bb.minY, bb.minZ)
+                .color(colorR, colorG, colorB, alphaChannel)
+                .endVertex();
+        worldRenderer.pos(bb.maxX, bb.minY, bb.maxZ)
+                .color(colorR, colorG, colorB, alphaChannel)
+                .endVertex();
+        worldRenderer.pos(bb.minX, bb.minY, bb.maxZ)
+                .color(colorR, colorG, colorB, alphaChannel)
+                .endVertex();
 
         if (bb.minY != bb.maxY) {
 
-            worldRenderer.addVertex(bb.minX, bb.maxY, bb.minZ);
-            worldRenderer.addVertex(bb.maxX, bb.maxY, bb.minZ);
-            worldRenderer.addVertex(bb.maxX, bb.maxY, bb.maxZ);
-            worldRenderer.addVertex(bb.minX, bb.maxY, bb.maxZ);
-
-            worldRenderer.addVertex(bb.minX, bb.minY, bb.maxZ);
-            worldRenderer.addVertex(bb.minX, bb.maxY, bb.maxZ);
-            worldRenderer.addVertex(bb.maxX, bb.maxY, bb.maxZ);
-            worldRenderer.addVertex(bb.maxX, bb.minY, bb.maxZ);
-
-            worldRenderer.addVertex(bb.minX, bb.minY, bb.minZ);
-            worldRenderer.addVertex(bb.minX, bb.maxY, bb.minZ);
-            worldRenderer.addVertex(bb.maxX, bb.maxY, bb.minZ);
-            worldRenderer.addVertex(bb.maxX, bb.minY, bb.minZ);
-
-            worldRenderer.addVertex(bb.minX, bb.minY, bb.minZ);
-            worldRenderer.addVertex(bb.minX, bb.minY, bb.maxZ);
-            worldRenderer.addVertex(bb.minX, bb.maxY, bb.maxZ);
-            worldRenderer.addVertex(bb.minX, bb.maxY, bb.minZ);
-
-            worldRenderer.addVertex(bb.maxX, bb.minY, bb.minZ);
-            worldRenderer.addVertex(bb.maxX, bb.minY, bb.maxZ);
-            worldRenderer.addVertex(bb.maxX, bb.maxY, bb.maxZ);
-            worldRenderer.addVertex(bb.maxX, bb.maxY, bb.minZ);
+            worldRenderer.pos(bb.minX, bb.maxY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.maxX, bb.maxY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.maxX, bb.maxY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.minX, bb.maxY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+
+            worldRenderer.pos(bb.minX, bb.minY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.minX, bb.maxY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.maxX, bb.maxY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.maxX, bb.minY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+
+            worldRenderer.pos(bb.minX, bb.minY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.minX, bb.maxY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.maxX, bb.maxY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.maxX, bb.minY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+
+            worldRenderer.pos(bb.minX, bb.minY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.minX, bb.minY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.minX, bb.maxY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.minX, bb.maxY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+
+            worldRenderer.pos(bb.maxX, bb.minY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.maxX, bb.minY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.maxX, bb.maxY, bb.maxZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
+            worldRenderer.pos(bb.maxX, bb.maxY, bb.minZ)
+                    .color(colorR, colorG, colorB, alphaChannel)
+                    .endVertex();
         }
         tessellator.draw();
     }
@@ -479,11 +539,12 @@ public class ClientProxy extends CommonProxy {
         GL11.glPointSize(2f);
 
         Tessellator tessellator = Tessellator.getInstance();
-        WorldRenderer worldRenderer = tessellator.getWorldRenderer();
-        worldRenderer.startDrawing(GL11.GL_POINTS);
-        worldRenderer.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 255);
+        VertexBuffer worldRenderer = tessellator.getBuffer();
+        worldRenderer.begin(GL11.GL_POINTS, DefaultVertexFormats.POSITION_COLOR);
         for (OffsetPoint point : buildPoints(center, radius)) {
-            worldRenderer.addVertex(point.getX(), point.getY(), point.getZ());
+            worldRenderer.pos(point.getX(), point.getY(), point.getZ())
+                    .color(color.getRed(), color.getGreen(), color.getBlue(), 255)
+                    .endVertex();
         }
         tessellator.draw();
     }
@@ -544,9 +605,9 @@ public class ClientProxy extends CommonProxy {
     private Set<BoundingBox> getClientBoundingBoxes() {
         Set<BoundingBox> boundingBoxes = new HashSet<BoundingBox>();
         if (worldData != null) {
-            World world = Minecraft.getMinecraft().theWorld;
-            int dimensionId = world.provider.getDimensionId();
-            if (dimensionId == 0) {
+            WorldClient world = Minecraft.getMinecraft().theWorld;
+            DimensionType dimensionType = world.provider.getDimensionType();
+            if (dimensionType == DimensionType.OVERWORLD) {
                 if (configManager.drawWorldSpawn.getBoolean()) {
                     boundingBoxes.add(getWorldSpawnBoundingBox(worldData.getSpawnX(), worldData.getSpawnZ()));
                     boundingBoxes.add(getSpawnChunksBoundingBox(worldData.getSpawnX(), worldData.getSpawnZ()));
@@ -555,8 +616,8 @@ public class ClientProxy extends CommonProxy {
                     boundingBoxes.add(getLazySpawnChunksBoundingBox(worldData.getSpawnX(), worldData.getSpawnZ()));
                 }
                 if (configManager.drawSlimeChunks.getBoolean()) {
-                    Set<ChunkCoordIntPair> activeChunks = getActiveChunks(world);
-                    for (ChunkCoordIntPair chunk : activeChunks) {
+                    Set<ChunkPos> activeChunks = world.getViewableChunks();
+                    for (ChunkPos chunk : activeChunks) {
                         if (isSlimeChunk(chunk.chunkXPos, chunk.chunkZPos)) {
                             boundingBoxes.add(BoundingBoxSlimeChunk.from(chunk, Color.GREEN));
                         }
index 3f6c2a64a919b39801609e28d26a0fcdaf1523d1..fd86488b866723fafcb9bc54eb85dbf76157c7bd 100644 (file)
@@ -1,7 +1,9 @@
 package com.irtimaled.bbor;
 
+import net.minecraft.world.DimensionType;
 import net.minecraft.world.World;
 import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkGenerator;
 import net.minecraft.world.chunk.IChunkProvider;
 import net.minecraft.world.gen.ChunkProviderServer;
 
@@ -10,7 +12,7 @@ import java.util.concurrent.ConcurrentHashMap;
 
 public class CommonProxy {
 
-    public Map<Integer, BoundingBoxCache> boundingBoxCacheMap = new ConcurrentHashMap<Integer, BoundingBoxCache>();
+    public Map<DimensionType, BoundingBoxCache> boundingBoxCacheMap = new ConcurrentHashMap<DimensionType, BoundingBoxCache>();
 
     public ConfigManager configManager;
     protected WorldData worldData;
@@ -23,18 +25,18 @@ public class CommonProxy {
     public void worldLoaded(World world) {
         IChunkProvider chunkProvider = world.getChunkProvider();
         if (chunkProvider instanceof ChunkProviderServer) {
-            chunkProvider = ReflectionHelper.getPrivateValue(ChunkProviderServer.class, (ChunkProviderServer) chunkProvider, IChunkProvider.class);
+            IChunkGenerator chunkGenerator = ReflectionHelper.getPrivateValue(ChunkProviderServer.class, (ChunkProviderServer) chunkProvider, IChunkGenerator.class);
             setWorldData(new WorldData(world.getSeed(), world.getWorldInfo().getSpawnX(), world.getWorldInfo().getSpawnZ()));
-            int dimensionId = world.provider.getDimensionId();
-            Logger.info("create world dimension: %d, %s (chunkprovider: %s) (seed: %d)", dimensionId, world.getClass().toString(), chunkProvider.getClass().toString(), worldData.getSeed());
-            boundingBoxCacheMap.put(dimensionId, new DimensionProcessor(eventHandler, configManager, world, dimensionId, chunkProvider));
+            DimensionType dimensionType = world.provider.getDimensionType();
+            Logger.info("create world dimension: %s, %s (chunkprovider: %s) (seed: %d)", dimensionType, world.getClass().toString(), chunkGenerator.getClass().toString(), worldData.getSeed());
+            boundingBoxCacheMap.put(dimensionType, new DimensionProcessor(eventHandler, configManager, world, dimensionType, chunkGenerator));
         }
     }
 
     public void chunkLoaded(Chunk chunk) {
-        int dimensionId = chunk.getWorld().provider.getDimensionId();
-        if (boundingBoxCacheMap.containsKey(dimensionId)) {
-            boundingBoxCacheMap.get(dimensionId).refresh();
+        DimensionType dimensionType = chunk.getWorld().provider.getDimensionType();
+        if (boundingBoxCacheMap.containsKey(dimensionType)) {
+            boundingBoxCacheMap.get(dimensionType).refresh();
         }
     }
 
index 1dd0d7aecdbbf902febabdbc7717112a2268da5e..52722cc386f7c5e272d23756f072b75bba374349 100644 (file)
@@ -27,6 +27,7 @@ public class ConfigManager {
     public Setting drawWorldSpawn;
     public Setting worldSpawnMaxY;
     public Setting drawLazySpawnChunks;
+    public Setting drawEndCities;
 
     private Configuration config;
 
@@ -54,6 +55,7 @@ public class ConfigManager {
         drawWorldSpawn = SetupBooleanProperty(config, "features", "drawWorldSpawn", true, "If set to true world spawn and spawn chunks bounding boxes are drawn. (default: true)");
         worldSpawnMaxY = SetupIntegerProperty(config, "features", "worldSpawnMaxY", -1, "The maximum top of the world spawn bounding boxes. If set to -1 it will use the value when activated, if set to 0 it will always track the players feet. (default: -1)");
         drawLazySpawnChunks = SetupBooleanProperty(config, "features", "drawLazySpawnChunks", false, "If set to true the lazy spawn chunks bounding boxes will be drawn. (default: false)");
+        drawEndCities = SetupBooleanProperty(config, "features", "drawEndCities", true, "If set to true end city bounding boxes will be drawn. (default: true)");
         config.save();
     }
 
index e2941044b7a3a7c11039326f27efb96432cc7843..eb037ed69652141927d94fea275d028e99badc15 100644 (file)
@@ -1,13 +1,15 @@
 package com.irtimaled.bbor;
 
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.util.math.ChunkPos;
 import net.minecraft.village.Village;
 import net.minecraft.village.VillageDoorInfo;
-import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.DimensionType;
 import net.minecraft.world.World;
-import net.minecraft.world.chunk.IChunkProvider;
-import net.minecraft.world.gen.ChunkProviderGenerate;
+import net.minecraft.world.chunk.IChunkGenerator;
+import net.minecraft.world.gen.ChunkProviderEnd;
 import net.minecraft.world.gen.ChunkProviderHell;
+import net.minecraft.world.gen.ChunkProviderOverworld;
 import net.minecraft.world.gen.structure.*;
 
 import java.awt.*;
@@ -20,19 +22,19 @@ public class DimensionProcessor extends BoundingBoxCache {
     private World world;
     private IEventHandler eventHandler;
 
-    public DimensionProcessor(IEventHandler eventHandler, ConfigManager configManager, World world, int dimensionId, IChunkProvider chunkProvider) {
+    public DimensionProcessor(IEventHandler eventHandler, ConfigManager configManager, World world, DimensionType dimensionType, IChunkGenerator chunkProvider) {
         this.eventHandler = eventHandler;
         this.configManager = configManager;
         this.world = world;
-        this.dimensionId = dimensionId;
+        this.dimensionType = dimensionType;
         this.chunkProvider = chunkProvider;
         villageCache = new HashMap<Integer, BoundingBoxVillage>();
         slimeChunkCache = new HashSet<BoundingBox>();
         worldSpawnCache = new HashSet<BoundingBox>();
     }
 
-    private int dimensionId;
-    private IChunkProvider chunkProvider;
+    private DimensionType dimensionType;
+    private IChunkGenerator chunkProvider;
     private Map<Integer, BoundingBoxVillage> villageCache;
     private Set<BoundingBox> slimeChunkCache;
     private Set<BoundingBox> worldSpawnCache;
@@ -49,11 +51,11 @@ public class DimensionProcessor extends BoundingBoxCache {
         super.close();
     }
 
-    private static <T extends IChunkProvider, R extends MapGenStructure> Collection<StructureStart> getStructures(T chunkProvider, Class<R> providerClass) {
+    private static <T extends IChunkGenerator, R extends MapGenStructure> Collection<StructureStart> getStructures(T chunkProvider, Class<R> providerClass) {
         Class<T> chunkProviderClass = (Class<T>) chunkProvider.getClass();
         R structureGenerator = ReflectionHelper.getPrivateValue(chunkProviderClass, chunkProvider, providerClass);
         if (structureGenerator != null) {
-            Map<ChunkCoordIntPair, StructureStart> structureMap = ReflectionHelper.getPrivateValue(MapGenStructure.class, structureGenerator, Map.class);
+            Map<ChunkPos, StructureStart> structureMap = ReflectionHelper.getPrivateValue(MapGenStructure.class, structureGenerator, Map.class);
             return structureMap.values();
         }
         return Collections.emptyList();
@@ -62,7 +64,7 @@ public class DimensionProcessor extends BoundingBoxCache {
     private Map<StructureType, Collection<StructureStart>> getStructures() {
 
         Map<StructureType, Collection<StructureStart>> structureMap = new HashMap<StructureType, Collection<StructureStart>>();
-        if (chunkProvider instanceof ChunkProviderGenerate) {
+        if (chunkProvider instanceof ChunkProviderOverworld) {
             if (configManager.drawDesertTemples.getBoolean()) {
                 structureMap.put(StructureType.DesertTemple, getStructuresWithComponent(getStructures(chunkProvider, MapGenScatteredFeature.class), ComponentScatteredFeaturePieces.DesertPyramid.class));
             }
@@ -91,6 +93,10 @@ public class DimensionProcessor extends BoundingBoxCache {
             if (configManager.drawNetherFortresses.getBoolean()) {
                 structureMap.put(StructureType.NetherFortress, getStructures(chunkProvider, MapGenNetherBridge.class));
             }
+        } else if(chunkProvider instanceof ChunkProviderEnd) {
+            if (configManager.drawEndCities.getBoolean()) {
+                structureMap.put(StructureType.EndCity, getStructures(chunkProvider, MapGenEndCity.class));
+            }
         }
 
         return structureMap;
@@ -99,7 +105,7 @@ public class DimensionProcessor extends BoundingBoxCache {
     private Collection<StructureStart> getStructuresWithComponent(Collection<StructureStart> structures, Class structureComponent) {
         Collection<StructureStart> validStructures = new HashSet<StructureStart>();
         for (StructureStart structure : structures) {
-            if (structure.getComponents().getFirst().getClass().equals(structureComponent)) {
+            if (structure.getComponents().get(0).getClass().equals(structureComponent)) {
                 validStructures.add(structure);
             }
         }
@@ -114,16 +120,18 @@ public class DimensionProcessor extends BoundingBoxCache {
         for (StructureType structureType : structureMap.keySet()) {
             Color color = structureType.getColor();
             for (StructureStart structureStart : structureMap.get(structureType)) {
-                BoundingBox boundingBox = BoundingBoxStructure.from(structureStart.getBoundingBox(), color);
-                if (!isCached(boundingBox)) {
-                    Set<BoundingBox> structureBoundingBoxes = new HashSet<BoundingBox>();
-                    Iterator structureComponents = structureStart.getComponents().iterator();
-                    while (structureComponents.hasNext()) {
-                        StructureComponent structureComponent = (StructureComponent) structureComponents.next();
-                        structureBoundingBoxes.add(BoundingBoxStructure.from(structureComponent.getBoundingBox(), color));
+                if (structureStart.getBoundingBox() != null) {
+                    BoundingBox boundingBox = BoundingBoxStructure.from(structureStart.getBoundingBox(), color);
+                    if (!isCached(boundingBox)) {
+                        Set<BoundingBox> structureBoundingBoxes = new HashSet<BoundingBox>();
+                        Iterator structureComponents = structureStart.getComponents().iterator();
+                        while (structureComponents.hasNext()) {
+                            StructureComponent structureComponent = (StructureComponent) structureComponents.next();
+                            structureBoundingBoxes.add(BoundingBoxStructure.from(structureComponent.getBoundingBox(), color));
+                        }
+                        addBoundingBoxes(boundingBox, structureBoundingBoxes);
+                        Logger.info("[%s] new boundingBoxCacheMap entries: %d", dimensionType, structureBoundingBoxes.size());
                     }
-                    addBoundingBoxes(boundingBox, structureBoundingBoxes);
-                    Logger.info("[%d] new boundingBoxCacheMap entries: %d", dimensionId, structureBoundingBoxes.size());
                 }
             }
         }
index 2901457692d7d3affe6215eb8098b4d380df8655..ddd39d05de2d96143ecb352486cea5b1113439fa 100644 (file)
@@ -10,6 +10,7 @@ public class StructureType {
     private static final int STRONGHOLD = 5;
     private static final int MINE_SHAFT = 6;
     private static final int NETHER_FORTRESS = 7;
+    private static final int END_CITY = 8;
 
     public final static StructureType JungleTemple = new StructureType(JUNGLE_TEMPLE);
     public final static StructureType DesertTemple = new StructureType(DESERT_TEMPLE);
@@ -18,6 +19,7 @@ public class StructureType {
     public final static StructureType Stronghold = new StructureType(STRONGHOLD);
     public final static StructureType MineShaft = new StructureType(MINE_SHAFT);
     public final static StructureType NetherFortress = new StructureType(NETHER_FORTRESS);
+    public final static StructureType EndCity = new StructureType(END_CITY);
 
 
     private final int type;
@@ -43,6 +45,8 @@ public class StructureType {
                 return Color.CYAN;
             case STRONGHOLD:
                 return Color.YELLOW;
+            case END_CITY:
+                return Color.MAGENTA;
         }
         return Color.WHITE;
     }