# 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?
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.
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)
@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());
}
}
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;
@SubscribeEvent
public void worldEvent(WorldEvent.Load event) {
- getProxy().worldLoaded(event.world);
+ getProxy().worldLoaded(event.getWorld());
}
@SubscribeEvent
@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);
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>());
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);
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);
}
}
}
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;
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;
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;
@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()) {
@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) {
}
}
- public int getDimension() {
- return dimension;
+ public DimensionType getDimensionType() {
+ return dimensionType;
}
public BoundingBox getKey() {
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
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;
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 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() {
@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