]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Initial 1.10 Forge Support
authorirtimaled <irtimaled@gmail.com>
Sat, 27 Aug 2016 19:34:17 +0000 (20:34 +0100)
committerirtimaled <irtimaled@gmail.com>
Sat, 27 Aug 2016 19:50:05 +0000 (20:50 +0100)
README.md
java/com/irtimaled/bbor/forge/ForgeClientProxy.java
java/com/irtimaled/bbor/forge/ForgeCommonProxy.java
java/com/irtimaled/bbor/forge/ForgeMod.java
java/com/irtimaled/bbor/forge/messages/AddBoundingBoxMessage.java
java/com/irtimaled/bbor/forge/messages/AddBoundingBoxMessageHandler.java
java/com/irtimaled/bbor/forge/messages/BoundingBoxDeserializer.java
java/com/irtimaled/bbor/forge/messages/BoundingBoxSerializer.java
java/com/irtimaled/bbor/forge/messages/RemoveBoundingBoxMessage.java
java/com/irtimaled/bbor/forge/messages/RemoveBoundingBoxMessageHandler.java

index 7818cbbbc7997bfbb548a86edc8c330e7109f1fb..6440fe46304f47d788aef9ec6c64a9acfade558e 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # BoundingBoxOutlineReloaded
 
-BoundingBoxOutlineReloaded is a mod for Minecraft 1.10 Vanilla
+BoundingBoxOutlineReloaded is a mod for Minecraft Forge 1.10 and Vanilla 1.10
 
 # Why did I make it?
 
@@ -27,7 +27,11 @@ 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
+# Installing (Forge Version)
+
+Make sure you have Forge 1.10 installed then drop the jar file into the mods/1.10 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)
 
 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.
 
@@ -88,5 +92,6 @@ 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.10 - [Download](http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.10.html)
 - 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 85e6db1af07e99ed0dedef305a0c88b4254047a0..040880df5b543dd1dba83b174e703efbbd1f08c5 100644 (file)
@@ -38,13 +38,13 @@ public class ForgeClientProxy extends ForgeCommonProxy {
 
     @SubscribeEvent
     public void renderWorldLastEvent(RenderWorldLastEvent event) {
-        getProxy().render(event.partialTicks);
+        getProxy().render(event.getPartialTicks());
     }
 
     @SubscribeEvent
     public void clientConnectionToServerEvent(FMLNetworkEvent.ClientConnectedToServerEvent evt) {
-        if (!evt.isLocal) {
-            getProxy().playerConnectedToServer(evt.manager);
+        if (!evt.isLocal()) {
+            getProxy().playerConnectedToServer(evt.getManager());
         }
     }
 
index 55489e5822115422d86ec9b07aaa2858b6118d0f..fd6be0d78518d3249bce0fd303bba6e375259d5c 100644 (file)
@@ -5,8 +5,10 @@ import com.irtimaled.bbor.forge.messages.*;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.DimensionType;
 import net.minecraftforge.event.world.ChunkEvent;
 import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.fml.common.FMLCommonHandler;
 import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
 import net.minecraftforge.fml.common.gameevent.PlayerEvent;
 import net.minecraftforge.fml.common.gameevent.TickEvent;
@@ -46,7 +48,7 @@ public class ForgeCommonProxy implements IEventHandler {
 
     @SubscribeEvent
     public void worldEvent(WorldEvent.Load event) {
-        getProxy().worldLoaded(event.world);
+        getProxy().worldLoaded(event.getWorld());
     }
 
     @SubscribeEvent
@@ -92,9 +94,8 @@ public class ForgeCommonProxy implements IEventHandler {
     @SubscribeEvent
     public void tickEvent(TickEvent event) {
         for (EntityPlayerMP player : playerDimensions.keySet()) {
-
-            MinecraftServer mc = MinecraftServer.getServer();
-            if (!mc.getConfigurationManager().playerEntityList.contains(player)) {
+            MinecraftServer mc = FMLCommonHandler.instance().getMinecraftServerInstance();
+            if(!mc.getPlayerList().getPlayerList().contains(player)) {
                 playerDimensions.remove(player);
             } else {
                 int dimension = playerDimensions.get(player);
@@ -112,14 +113,14 @@ public class ForgeCommonProxy implements IEventHandler {
     private void sendToPlayer(EntityPlayerMP player, BoundingBoxCache boundingBoxCache) {
         Map<BoundingBox, Set<BoundingBox>> cacheSubset = getBoundingBoxMap(player, boundingBoxCache.getBoundingBoxes());
 
-        int dimension = player.dimension;
+        DimensionType dimensionType = DimensionType.getById(player.dimension);
         if (cacheSubset.keySet().size() > 0) {
-            Logger.info("send %d entries to %s (%d)", cacheSubset.keySet().size(), player.getDisplayNameString(), dimension);
+            Logger.info("send %d entries to %s (%s)", cacheSubset.keySet().size(), player.getDisplayNameString(), dimensionType);
         }
 
         for (BoundingBox key : cacheSubset.keySet()) {
             Set<BoundingBox> boundingBoxes = cacheSubset.get(key);
-            network.sendTo(AddBoundingBoxMessage.from(dimension, key, boundingBoxes), player);
+            network.sendTo(AddBoundingBoxMessage.from(dimensionType, key, boundingBoxes), player);
 
             if (!playerBoundingBoxesCache.containsKey(player)) {
                 playerBoundingBoxesCache.put(player, new HashSet<BoundingBox>());
@@ -138,12 +139,10 @@ public class ForgeCommonProxy implements IEventHandler {
         return cacheSubset;
     }
 
-    public void boundingBoxRemoved(BoundingBox bb) {
-        // the only bounding boxes that can change are spawn or villages - both of these are in overworld so I guess
-        // hard coding dimension 0 is okay.
-        RemoveBoundingBoxMessage message = RemoveBoundingBoxMessage.from(0, bb);
+    public void boundingBoxRemoved(DimensionType dimensionType, BoundingBox bb) {
+        RemoveBoundingBoxMessage message = RemoveBoundingBoxMessage.from(dimensionType, bb);
         for (EntityPlayerMP player : playerDimensions.keySet()) {
-            if (player.dimension == 0) {
+            if (DimensionType.getById(player.dimension) == dimensionType) {
                 Logger.info("remove 1 entry from %s (0)", player.getDisplayNameString());
                 network.sendTo(message, player);
 
@@ -159,20 +158,20 @@ public class ForgeCommonProxy implements IEventHandler {
         getProxy().setWorldData(worldData);
     }
 
-    public void addBoundingBox(int dimension, BoundingBox key, Set<BoundingBox> boundingBoxes) {
-        Map<Integer, BoundingBoxCache> boundingBoxCacheMap = getProxy().boundingBoxCacheMap;
-        if (!boundingBoxCacheMap.containsKey(dimension)) {
-            boundingBoxCacheMap.put(dimension, new BoundingBoxCache());
+    public void addBoundingBox(DimensionType dimensionType, BoundingBox key, Set<BoundingBox> boundingBoxes) {
+        Map<DimensionType, BoundingBoxCache> boundingBoxCacheMap = getProxy().boundingBoxCacheMap;
+        if (!boundingBoxCacheMap.containsKey(dimensionType)) {
+            boundingBoxCacheMap.put(dimensionType, new BoundingBoxCache());
         }
 
-        boundingBoxCacheMap.get(dimension).addBoundingBoxes(key, boundingBoxes);
+        boundingBoxCacheMap.get(dimensionType).addBoundingBoxes(key, boundingBoxes);
     }
 
-    public void removeBoundingBox(int dimension, BoundingBox key) {
-        Map<Integer, BoundingBoxCache> boundingBoxCacheMap = getProxy().boundingBoxCacheMap;
+    public void removeBoundingBox(DimensionType dimensionType, BoundingBox key) {
+        Map<DimensionType, BoundingBoxCache> boundingBoxCacheMap = getProxy().boundingBoxCacheMap;
 
-        if (boundingBoxCacheMap.containsKey(dimension)) {
-            boundingBoxCacheMap.get(dimension).removeBoundingBox(key);
+        if (boundingBoxCacheMap.containsKey(dimensionType)) {
+            boundingBoxCacheMap.get(dimensionType).removeBoundingBox(key);
         }
     }
 }
index 11c5ccf392587ae1660a1e5d74433daa0c5faaa8..8d6a98f075d64b426697dc36fc6015af410f9ca1 100644 (file)
@@ -14,8 +14,8 @@ public class ForgeMod {
 
     public static final String MODID = "bbor";
     public static final String NAME = "Bounding Box Outline Reloaded";
-    public static final String VERSION = "1.0.0-beta11";
-    public static final String MCVERSION = "[1.8,1.8.9)";
+    public static final String VERSION = "1.0.0-beta12";
+    public static final String MCVERSION = "[1.10]";
 
     private ConfigManager configManager;
 
index 94f8246853b12627528e8a55306bc32aa88ab1e8..3ac62dc88cf7dab3c3ff8b9bf7785bac9a0be645 100644 (file)
@@ -2,6 +2,7 @@ package com.irtimaled.bbor.forge.messages;
 
 import com.irtimaled.bbor.BoundingBox;
 import io.netty.buffer.ByteBuf;
+import net.minecraft.world.DimensionType;
 import net.minecraftforge.fml.common.network.ByteBufUtils;
 import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
 
@@ -9,13 +10,13 @@ import java.util.HashSet;
 import java.util.Set;
 
 public class AddBoundingBoxMessage implements IMessage {
-    private int dimension;
+    private DimensionType dimensionType;
     private BoundingBox key;
     private Set<BoundingBox> boundingBoxes;
 
-    public static AddBoundingBoxMessage from(int dimension, BoundingBox key, Set<BoundingBox> boundingBoxes) {
+    public static AddBoundingBoxMessage from(DimensionType dimensionType, BoundingBox key, Set<BoundingBox> boundingBoxes) {
         AddBoundingBoxMessage message = new AddBoundingBoxMessage();
-        message.dimension = dimension;
+        message.dimensionType = dimensionType;
         message.key = key;
         message.boundingBoxes = boundingBoxes;
         return message;
@@ -23,7 +24,7 @@ public class AddBoundingBoxMessage implements IMessage {
 
     @Override
     public void fromBytes(ByteBuf buf) {
-        dimension = ByteBufUtils.readVarInt(buf, 5);
+        dimensionType = DimensionType.getById(ByteBufUtils.readVarInt(buf, 5));
         key = BoundingBoxDeserializer.deserialize(buf);
         boundingBoxes = new HashSet<BoundingBox>();
         while (buf.isReadable()) {
@@ -36,7 +37,7 @@ public class AddBoundingBoxMessage implements IMessage {
 
     @Override
     public void toBytes(ByteBuf buf) {
-        ByteBufUtils.writeVarInt(buf, dimension, 5);
+        ByteBufUtils.writeVarInt(buf, dimensionType.getId(), 5);
         BoundingBoxSerializer.serialize(key, buf);
         if (boundingBoxes != null &&
                 boundingBoxes.size() > 1) {
@@ -46,8 +47,8 @@ public class AddBoundingBoxMessage implements IMessage {
         }
     }
 
-    public int getDimension() {
-        return dimension;
+    public DimensionType getDimensionType() {
+        return dimensionType;
     }
 
     public BoundingBox getKey() {
index 829fc348f6db03d0dd5847f3e69e8a744017a0ec..2122aacc9c655319d82b021a543479c2060e6876 100644 (file)
@@ -8,7 +8,7 @@ import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
 public class AddBoundingBoxMessageHandler implements IMessageHandler<AddBoundingBoxMessage, IMessage> {
     @Override
     public IMessage onMessage(AddBoundingBoxMessage message, MessageContext ctx) {
-        ForgeMod.proxy.addBoundingBox(message.getDimension(), message.getKey(), message.getBoundingBoxes());
+        ForgeMod.proxy.addBoundingBox(message.getDimensionType(), message.getKey(), message.getBoundingBoxes());
         return null;
     }
 }
\ No newline at end of file
index a17c4c44d302e0ad263c3461cfc2aad18f18112b..ef68c43b67cb28facdb98c02a1da3389639eccc1 100644 (file)
@@ -4,11 +4,10 @@ import com.irtimaled.bbor.BoundingBox;
 import com.irtimaled.bbor.BoundingBoxStructure;
 import com.irtimaled.bbor.BoundingBoxVillage;
 import io.netty.buffer.ByteBuf;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
 import net.minecraftforge.fml.common.network.ByteBufUtils;
 
 import java.awt.*;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
 
index 5993bc1c48644fb6f72753b8975816400650b49a..8c6bbbe8b8cad727d1192c101a4281c1bf37123c 100644 (file)
@@ -4,7 +4,7 @@ import com.irtimaled.bbor.BoundingBox;
 import com.irtimaled.bbor.BoundingBoxStructure;
 import com.irtimaled.bbor.BoundingBoxVillage;
 import io.netty.buffer.ByteBuf;
-import net.minecraft.util.BlockPos;
+import net.minecraft.util.math.BlockPos;
 import net.minecraftforge.fml.common.network.ByteBufUtils;
 
 import java.awt.*;
index 697942f716ca2c3c7cb169679ea4ddb08d703baa..f59089c88816d57cf728be1ce869a7a79917a31d 100644 (file)
@@ -2,34 +2,35 @@ package com.irtimaled.bbor.forge.messages;
 
 import com.irtimaled.bbor.BoundingBox;
 import io.netty.buffer.ByteBuf;
+import net.minecraft.world.DimensionType;
 import net.minecraftforge.fml.common.network.ByteBufUtils;
 import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
 
 public class RemoveBoundingBoxMessage implements IMessage {
-    private int dimension;
+    private DimensionType dimensionType;
     private BoundingBox key;
 
-    public static RemoveBoundingBoxMessage from(int dimension, BoundingBox key) {
+    public static RemoveBoundingBoxMessage from(DimensionType dimensionType, BoundingBox key) {
         RemoveBoundingBoxMessage message = new RemoveBoundingBoxMessage();
-        message.dimension = dimension;
+        message.dimensionType = dimensionType;
         message.key = key;
         return message;
     }
 
     @Override
     public void fromBytes(ByteBuf buf) {
-        dimension = ByteBufUtils.readVarInt(buf, 5);
+        dimensionType = DimensionType.getById(ByteBufUtils.readVarInt(buf, 5));
         key = BoundingBoxDeserializer.deserialize(buf);
     }
 
     @Override
     public void toBytes(ByteBuf buf) {
-        ByteBufUtils.writeVarInt(buf, dimension, 5);
+        ByteBufUtils.writeVarInt(buf, dimensionType.getId(), 5);
         BoundingBoxSerializer.serialize(key, buf);
     }
 
-    public int getDimension() {
-        return dimension;
+    public DimensionType getDimensionType() {
+        return dimensionType;
     }
 
     public BoundingBox getKey() {
index 7604f0a6b25d91a7ebfe5dbefc3f4c3d7c2e074d..13eb1f10b033dabd4eb60773e4a1f5fc0c738664 100644 (file)
@@ -9,7 +9,7 @@ public class RemoveBoundingBoxMessageHandler implements IMessageHandler<RemoveBo
     @Override
     public IMessage onMessage(RemoveBoundingBoxMessage message, MessageContext ctx) {
 
-        ForgeMod.proxy.removeBoundingBox(message.getDimension(), message.getKey());
+        ForgeMod.proxy.removeBoundingBox(message.getDimensionType(), message.getKey());
         return null;
     }
 }
\ No newline at end of file