]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Tidy up code a bit
authorirtimaled <irtimaled@gmail.com>
Thu, 28 Dec 2017 05:28:26 +0000 (21:28 -0800)
committerirtimaled <irtimaled@gmail.com>
Sat, 30 Dec 2017 03:48:26 +0000 (19:48 -0800)
26 files changed:
java/com/irtimaled/bbor/BoundingBox.java
java/com/irtimaled/bbor/BoundingBoxCache.java
java/com/irtimaled/bbor/BoundingBoxOutlineReloaded.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/Logger.java
java/com/irtimaled/bbor/ReflectionHelper.java
java/com/irtimaled/bbor/StructureType.java
java/com/irtimaled/bbor/config/Configuration.java
java/com/irtimaled/bbor/config/Setting.java
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/InitializeClientMessage.java
java/com/irtimaled/bbor/forge/messages/RemoveBoundingBoxMessageHandler.java
resources/pack.mcmeta [new file with mode: 0644]

index 3e5b9776cd9a561150cc0885c00a72a25b76d97d..749a727dda835da164382df7e13803d1cc35f4de 100644 (file)
@@ -68,4 +68,4 @@ public abstract class BoundingBox {
     public Color getColor() {
         return color;
     }
-}
\ No newline at end of file
+}
index 14633a4b90fb684e56f88722dfad6f5ff484041b..53dcde70000939123186d78f4da744d8c44524e3 100644 (file)
@@ -6,8 +6,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 public class BoundingBoxCache {
-
-    private Map<BoundingBox, Set<BoundingBox>> cache = new ConcurrentHashMap<BoundingBox, Set<BoundingBox>>();
+    private Map<BoundingBox, Set<BoundingBox>> cache = new ConcurrentHashMap<>();
 
     public Map<BoundingBox, Set<BoundingBox>> getBoundingBoxes() {
         return cache;
@@ -29,7 +28,7 @@ public class BoundingBoxCache {
     }
 
     public void addBoundingBox(BoundingBox key) {
-        Set<BoundingBox> boundingBoxes = new HashSet<BoundingBox>();
+        Set<BoundingBox> boundingBoxes = new HashSet<>();
         boundingBoxes.add(key);
         addBoundingBoxes(key, boundingBoxes);
     }
@@ -39,4 +38,4 @@ public class BoundingBoxCache {
             cache.remove(key);
         }
     }
-}
\ No newline at end of file
+}
index f8a7e38290dbeaca6fd7b61920dc130de24d1f3a..dfb47714185b9ac13280a28ddfcc882afc6e212a 100644 (file)
@@ -8,7 +8,6 @@ import net.minecraft.world.chunk.Chunk;
 import java.io.File;
 
 public class BoundingBoxOutlineReloaded {
-
     public static ClientProxy proxy;
 
     public static void init() {
@@ -40,5 +39,3 @@ public class BoundingBoxOutlineReloaded {
         proxy.playerDisconnectedFromServer();
     }
 }
-
-
index b5418f578e7e6313666c81cefa4659390a9a97bb..c8b85a0280c8c1667bc3c5b9bfe6345124e0c3ce 100644 (file)
@@ -20,4 +20,3 @@ public class BoundingBoxSlimeChunk extends BoundingBox {
         return new BoundingBoxSlimeChunk(minBlockPos, maxBlockPos, color);
     }
 }
-
index 63b2c0529b7457e90ab7c9fe15cc5c3464350114..cbddbd32a8cc28828d43179ae38948a020d8a53e 100644 (file)
@@ -25,4 +25,4 @@ public class BoundingBoxStructure extends BoundingBox {
     public static BoundingBoxStructure from(BlockPos minBlockPos, BlockPos maxBlockPos, Color color) {
         return new BoundingBoxStructure(minBlockPos, maxBlockPos, color);
     }
-}
\ No newline at end of file
+}
index a5269716862d3024e6005d55a86c1d74c9b2c667..58ac6e3df94547e8c5c633d6e2253cc1d53242cb 100644 (file)
@@ -43,8 +43,7 @@ public class BoundingBoxVillage extends BoundingBox {
         return new BoundingBoxVillage(center, radius, color, spawnsIronGolems, doors, minBlockPos, maxBlockPos);
     }
 
-    private void calculateCenterOffsets(Set<BlockPos> doors)
-    {
+    private void calculateCenterOffsets(Set<BlockPos> doors) {
         boolean processedFirstDoor = false;
         int minX = 0;
         int maxX = 0;
@@ -66,8 +65,8 @@ public class BoundingBoxVillage extends BoundingBox {
 
             processedFirstDoor = true;
         }
-        centerOffsetX = Math.abs(maxX-minX) % 2 == 0 ? 0.5 : (minX < 0 ? 0 : 1);
-        centerOffsetZ = Math.abs(maxZ-minZ) % 2 == 0 ? 0.5 : (minZ < 0 ? 0 : 1);
+        centerOffsetX = Math.abs(maxX - minX) % 2 == 0 ? 0.5 : (minX < 0 ? 0 : 1);
+        centerOffsetZ = Math.abs(maxZ - minZ) % 2 == 0 ? 0.5 : (minZ < 0 ? 0 : 1);
     }
 
     @Override
@@ -92,10 +91,10 @@ public class BoundingBoxVillage extends BoundingBox {
     }
 
     @Override
-    public int hashCode()
-    { final int prime = 31;
+    public int hashCode() {
+        final int prime = 31;
         int result = super.hashCode();
-        for(BlockPos door : doors) {
+        for (BlockPos door : doors) {
             result = prime * result + door.hashCode();
         }
         return result;
@@ -129,4 +128,4 @@ public class BoundingBoxVillage extends BoundingBox {
     public Set<BlockPos> getDoors() {
         return doors;
     }
-}
\ No newline at end of file
+}
index ef7d11103a7ac0e790368810d9a797436cd349e0..3820110264cd0a4561045536e0c91c721a6b71a2 100644 (file)
@@ -5,7 +5,6 @@ import net.minecraft.util.math.BlockPos;
 import java.awt.*;
 
 public class BoundingBoxWorldSpawn extends BoundingBox {
-
     protected BoundingBoxWorldSpawn(BlockPos minBlockPos, BlockPos maxBlockPos, Color color) {
         super(minBlockPos, maxBlockPos, color);
     }
index c51d39b8d54b185f238e6d9edf52997b3773e204..eeee8b6356677f33cc3c945f703fd628af46bf69 100644 (file)
@@ -32,7 +32,6 @@ import java.util.Random;
 import java.util.Set;
 
 public class ClientProxy extends CommonProxy {
-
     private double activeY;
     private boolean active;
     private boolean outerBoxOnly;
@@ -50,8 +49,7 @@ public class ClientProxy extends CommonProxy {
             active = !active;
             if (active)
                 activeY = playerY;
-        } else
-        if(outerBoxOnlyHotKey.isPressed()){
+        } else if (outerBoxOnlyHotKey.isPressed()) {
             outerBoxOnly = !outerBoxOnly;
         }
     }
@@ -112,7 +110,7 @@ public class ClientProxy extends CommonProxy {
             localStructuresFolder = new File(configManager.configDir, path);
             Logger.info("Looking for local structures (folder=%s)", localStructuresFolder.getAbsolutePath());
         }
-        if (!localStructuresFolder.exists())        {
+        if (!localStructuresFolder.exists()) {
             Logger.info("No local structures folders found");
             return;
         }
@@ -139,7 +137,7 @@ public class ClientProxy extends CommonProxy {
         if (configManager.drawStrongholds.getBoolean()) {
             loadStructureNbtFile(localStructuresFolder, cache, "Stronghold.dat", StructureType.Stronghold.getColor(), "*");
         }
-        if (configManager.drawMansions.getBoolean()){
+        if (configManager.drawMansions.getBoolean()) {
             loadStructureNbtFile(localStructuresFolder, cache, "Mansion.dat", StructureType.Mansion.getColor(), "*");
         }
         if (configManager.drawMineShafts.getBoolean()) {
@@ -193,7 +191,7 @@ public class ClientProxy extends CommonProxy {
     }
 
     private Set<BlockPos> getDoors(NBTTagCompound village) {
-        Set<BlockPos> doors = new HashSet<BlockPos>();
+        Set<BlockPos> doors = new HashSet<>();
         for (NBTTagCompound door : getChildCompoundTags(village, "Doors")) {
             doors.add(new BlockPos(door.getInteger("X"), door.getInteger("Y"), door.getInteger("Z")));
         }
@@ -212,7 +210,7 @@ public class ClientProxy extends CommonProxy {
         for (Object key : features.getKeySet()) {
             NBTTagCompound feature = features.getCompoundTag((String) key);
             BoundingBox structure = BoundingBoxStructure.from(feature.getIntArray("BB"), color);
-            Set<BoundingBox> boundingBoxes = new HashSet<BoundingBox>();
+            Set<BoundingBox> boundingBoxes = new HashSet<>();
             NBTTagCompound[] children = getChildCompoundTags(feature, "Children");
             for (NBTTagCompound child : children) {
                 if (id.equals(child.getString("id")) || id.equals("*"))
@@ -272,7 +270,7 @@ public class ClientProxy extends CommonProxy {
     }
 
     private void renderBoundingBoxes(Map<BoundingBox, Set<BoundingBox>> map, Set<BoundingBox> clientBoundingBoxes) {
-        if(map == null && clientBoundingBoxes == null)
+        if (map == null && clientBoundingBoxes == null)
             return;
 
         GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -284,16 +282,16 @@ public class ClientProxy extends CommonProxy {
             GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
         }
 
-        if(map != null)
-        for (BoundingBox bb : map.keySet()) {
-            if (outerBoxOnly) {
-                renderBoundingBoxSet(map.get(bb));
-            } else {
-                renderBoundingBoxByType(bb);
+        if (map != null)
+            for (BoundingBox bb : map.keySet()) {
+                if (outerBoxOnly) {
+                    renderBoundingBoxSet(map.get(bb));
+                } else {
+                    renderBoundingBoxByType(bb);
+                }
             }
-        }
 
-        if(clientBoundingBoxes != null)
+        if (clientBoundingBoxes != null)
             renderBoundingBoxSet(clientBoundingBoxes);
 
         GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
@@ -302,10 +300,10 @@ public class ClientProxy extends CommonProxy {
     }
 
     private void renderBoundingBoxSet(Set<BoundingBox> bbList) {
-        if(bbList != null)
-        for (BoundingBox bb : bbList) {
-            renderBoundingBoxByType(bb);
-        }
+        if (bbList != null)
+            for (BoundingBox bb : bbList) {
+                renderBoundingBoxByType(bb);
+            }
     }
 
     private void renderBoundingBoxByType(BoundingBox bb) {
@@ -325,7 +323,7 @@ public class ClientProxy extends CommonProxy {
                     villageBB.getSpawnsIronGolems()) {
                 renderIronGolemSpawnArea(villageBB);
             }
-            if(configManager.drawVillageDoors.getBoolean())
+            if (configManager.drawVillageDoors.getBoolean())
                 renderVillageDoors(villageBB);
         } else if (bb instanceof BoundingBoxSlimeChunk) {
             renderSlimeChunk((BoundingBoxSlimeChunk) bb);
@@ -361,7 +359,6 @@ public class ClientProxy extends CommonProxy {
     }
 
     private double getMaxY(double configMaxY) {
-
         if (configMaxY == -1) {
             return activeY;
         } else if ((configMaxY == 0) || (playerY < configMaxY)) {
@@ -459,7 +456,6 @@ public class ClientProxy extends CommonProxy {
                 .endVertex();
 
         if (bb.minY != bb.maxY) {
-
             worldRenderer.pos(bb.minX, bb.maxY, bb.minZ)
                     .color(colorR, colorG, colorB, alphaChannel)
                     .endVertex();
@@ -541,7 +537,8 @@ public class ClientProxy extends CommonProxy {
 
     private void renderBoundingBoxVillageAsSphere(BoundingBoxVillage bb) {
         OffsetPoint center = new OffsetPoint(bb.getCenter())
-                .add(bb.getCenterOffsetX(), 0.0, bb.getCenterOffsetZ());;
+                .add(bb.getCenterOffsetX(), 0.0, bb.getCenterOffsetZ());
+        ;
         int radius = bb.getRadius();
         Color color = bb.getColor();
         renderSphere(center, radius, color);
@@ -597,7 +594,7 @@ public class ClientProxy extends CommonProxy {
     }
 
     private Set<OffsetPoint> buildPoints(OffsetPoint center, double radius) {
-        Set<OffsetPoint> points = new HashSet<OffsetPoint>(1200);
+        Set<OffsetPoint> points = new HashSet<>(1200);
 
         double tau = 6.283185307179586D;
         double pi = tau / 2D;
@@ -619,7 +616,7 @@ public class ClientProxy extends CommonProxy {
             return null;
         }
 
-        Set<BoundingBox> boundingBoxes = new HashSet<BoundingBox>();
+        Set<BoundingBox> boundingBoxes = new HashSet<>();
         if (configManager.drawWorldSpawn.getBoolean()) {
             boundingBoxes.add(getWorldSpawnBoundingBox(worldData.getSpawnX(), worldData.getSpawnZ()));
             boundingBoxes.add(getSpawnChunksBoundingBox(worldData.getSpawnX(), worldData.getSpawnZ()));
@@ -638,8 +635,8 @@ public class ClientProxy extends CommonProxy {
         int renderDistanceChunks = minecraft.gameSettings.renderDistanceChunks;
         int playerChunkX = MathHelper.floor(minecraft.player.posX / 16.0D);
         int playerChunkZ = MathHelper.floor(minecraft.player.posZ / 16.0D);
-        Set<BoundingBoxSlimeChunk> slimeChunks = new HashSet<BoundingBoxSlimeChunk>();
-        for (int chunkX = playerChunkX-renderDistanceChunks; chunkX <= playerChunkX+renderDistanceChunks; ++chunkX) {
+        Set<BoundingBoxSlimeChunk> slimeChunks = new HashSet<>();
+        for (int chunkX = playerChunkX - renderDistanceChunks; chunkX <= playerChunkX + renderDistanceChunks; ++chunkX) {
             for (int chunkZ = playerChunkZ - renderDistanceChunks; chunkZ <= playerChunkZ + renderDistanceChunks; ++chunkZ) {
                 if (isSlimeChunk(chunkX, chunkZ)) {
                     ChunkPos chunk = new ChunkPos(chunkX, chunkZ);
index 7ff00a7aec01e129a002e020df2181fc60403fcc..0799ca82e94e1c241b5874bb6bb2c7ce487fa563 100644 (file)
@@ -3,16 +3,15 @@ package com.irtimaled.bbor;
 import net.minecraft.world.DimensionType;
 import net.minecraft.world.World;
 import net.minecraft.world.chunk.Chunk;
-import net.minecraft.world.gen.IChunkGenerator;
 import net.minecraft.world.chunk.IChunkProvider;
 import net.minecraft.world.gen.ChunkProviderServer;
+import net.minecraft.world.gen.IChunkGenerator;
 
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 public class CommonProxy {
-
-    public Map<DimensionType, BoundingBoxCache> boundingBoxCacheMap = new ConcurrentHashMap<DimensionType, BoundingBoxCache>();
+    public Map<DimensionType, BoundingBoxCache> boundingBoxCacheMap = new ConcurrentHashMap<>();
 
     public ConfigManager configManager;
     protected WorldData worldData;
index a478629b44e6f7c6230dfd9da63af04b64bc3340..d31d395063e96f5da0c99630d60071e5c8164ed1 100644 (file)
@@ -74,4 +74,4 @@ public class ConfigManager {
         property.set(property.getInt(defaultValue));
         return property;
     }
-}
\ No newline at end of file
+}
index b68f3ca3e866ba3c65f6cbd9a23194b16465374b..27d3f1558df5538e48d6b0f3d6f2b0224c1b3a92 100644 (file)
@@ -17,7 +17,6 @@ import java.util.*;
 import java.util.List;
 
 public class DimensionProcessor extends BoundingBoxCache {
-
     private ConfigManager configManager;
     private World world;
     private IEventHandler eventHandler;
@@ -28,9 +27,9 @@ public class DimensionProcessor extends BoundingBoxCache {
         this.world = world;
         this.dimensionType = dimensionType;
         this.chunkGenerator = chunkGenerator;
-        villageCache = new HashMap<Integer, BoundingBoxVillage>();
-        slimeChunkCache = new HashSet<BoundingBox>();
-        worldSpawnCache = new HashSet<BoundingBox>();
+        villageCache = new HashMap<>();
+        slimeChunkCache = new HashSet<>();
+        worldSpawnCache = new HashSet<>();
     }
 
     private DimensionType dimensionType;
@@ -62,8 +61,7 @@ public class DimensionProcessor extends BoundingBoxCache {
     }
 
     private Map<StructureType, Collection<StructureStart>> getStructures() {
-
-        Map<StructureType, Collection<StructureStart>> structureMap = new HashMap<StructureType, Collection<StructureStart>>();
+        Map<StructureType, Collection<StructureStart>> structureMap = new HashMap<>();
         if (chunkGenerator instanceof ChunkGeneratorOverworld) {
             if (configManager.drawDesertTemples.getBoolean()) {
                 structureMap.put(StructureType.DesertTemple, getStructuresWithComponent(getStructures(chunkGenerator, MapGenScatteredFeature.class), ComponentScatteredFeaturePieces.DesertPyramid.class));
@@ -93,11 +91,10 @@ public class DimensionProcessor extends BoundingBoxCache {
                 structureMap.put(StructureType.MineShaft, getStructures(chunkGenerator, MapGenMineshaft.class));
             }
         } else if (chunkGenerator instanceof ChunkGeneratorHell) {
-
             if (configManager.drawNetherFortresses.getBoolean()) {
                 structureMap.put(StructureType.NetherFortress, getStructures(chunkGenerator, MapGenNetherBridge.class));
             }
-        } else if(chunkGenerator instanceof ChunkGeneratorEnd) {
+        } else if (chunkGenerator instanceof ChunkGeneratorEnd) {
             if (configManager.drawEndCities.getBoolean()) {
                 structureMap.put(StructureType.EndCity, getStructures(chunkGenerator, MapGenEndCity.class));
             }
@@ -107,7 +104,7 @@ public class DimensionProcessor extends BoundingBoxCache {
     }
 
     private Collection<StructureStart> getStructuresWithComponent(Collection<StructureStart> structures, Class structureComponent) {
-        Collection<StructureStart> validStructures = new HashSet<StructureStart>();
+        Collection<StructureStart> validStructures = new HashSet<>();
         for (StructureStart structure : structures) {
             if (structure.getComponents().get(0).getClass().equals(structureComponent)) {
                 validStructures.add(structure);
@@ -127,10 +124,8 @@ public class DimensionProcessor extends BoundingBoxCache {
                 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();
+                        Set<BoundingBox> structureBoundingBoxes = new HashSet<>();
+                        for (StructureComponent structureComponent : structureStart.getComponents()) {
                             structureBoundingBoxes.add(BoundingBoxStructure.from(structureComponent.getBoundingBox(), color));
                         }
                         addBoundingBoxes(boundingBox, structureBoundingBoxes);
@@ -141,9 +136,8 @@ public class DimensionProcessor extends BoundingBoxCache {
         }
 
         if (configManager.drawVillages.getBoolean() &&
-                (world.getVillageCollection() != null)) {
-
-            Map<Integer, BoundingBoxVillage> villageBoundingBoxes = new HashMap<Integer, BoundingBoxVillage>();
+                world.getVillageCollection() != null) {
+            Map<Integer, BoundingBoxVillage> villageBoundingBoxes = new HashMap<>();
             List<Village> villages = world.getVillageCollection().getVillageList();
             for (Village village : villages) {
                 int villageId = village.hashCode();
@@ -170,7 +164,7 @@ public class DimensionProcessor extends BoundingBoxCache {
     }
 
     private Set<BlockPos> getDoorsFromVillage(Village village) {
-        Set<BlockPos> doors = new HashSet<BlockPos>();
+        Set<BlockPos> doors = new HashSet<>();
         for (Object doorInfo : village.getVillageDoorInfoList()) {
             VillageDoorInfo villageDoorInfo = (VillageDoorInfo) doorInfo;
             doors.add(villageDoorInfo.getDoorBlockPos());
@@ -181,7 +175,7 @@ public class DimensionProcessor extends BoundingBoxCache {
     private void processDelta(Map<Integer, BoundingBoxVillage> oldVillages, Map<Integer, BoundingBoxVillage> newVillages) {
         for (BoundingBox village : oldVillages.values()) {
             removeBoundingBox(village);
-            if(eventHandler!=null) {
+            if (eventHandler != null) {
                 eventHandler.boundingBoxRemoved(this.dimensionType, village);
             }
         }
@@ -190,4 +184,4 @@ public class DimensionProcessor extends BoundingBoxCache {
                 addBoundingBox(village);
         }
     }
-}
\ No newline at end of file
+}
index e8aca30b53a5076cb840065865b9494a1b2e01b7..d19550bc69786bdaafb1f973bf7346da242a7622 100644 (file)
@@ -5,11 +5,11 @@ import org.apache.logging.log4j.LogManager;
 public class Logger {
     private static final org.apache.logging.log4j.Logger logger = LogManager.getLogger();
 
-
     public static void info(String s, Object... objects) {
-        if (objects.length == 0)
+        if (objects.length == 0) {
             logger.info(s);
-        else
+        } else {
             logger.info(String.format(s, objects));
+        }
     }
-}
\ No newline at end of file
+}
index 6602f9a64081d27fd37663ce73e3efb2021cb8bc..afc8f27bf62fdd67ad2bff49a56bd6f2979cfab9 100644 (file)
@@ -5,7 +5,6 @@ import java.util.HashMap;
 import java.util.Map;
 
 public class ReflectionHelper {
-
     public static <T, R> R getPrivateValue(Class<T> sourceClass, T instance, Class<R> resultClass) {
         try {
             Field f = getField(sourceClass, resultClass);
@@ -17,17 +16,16 @@ public class ReflectionHelper {
         return null;
     }
 
-    private static Map<Class, Map<Class, Field>> fieldMap = new HashMap<Class, Map<Class, Field>>();
+    private static Map<Class, Map<Class, Field>> fieldMap = new HashMap<>();
 
     protected static <T, R> Field getField(Class<T> sourceClass, Class<R> resultClass) {
         Map<Class, Field> map = fieldMap.get(sourceClass);
-        if(map == null)
-        {
-            map = new HashMap<Class, Field>();
+        if (map == null) {
+            map = new HashMap<>();
             fieldMap.put(sourceClass, map);
         }
         Field field = map.get(resultClass);
-        if(field == null) {
+        if (field == null) {
             field = getFieldUsingReflection(sourceClass, resultClass);
             if (field != null) {
                 field.setAccessible(true);
@@ -39,12 +37,12 @@ public class ReflectionHelper {
 
     private static <T, R> Field getFieldUsingReflection(Class<T> sourceClass, Class<R> resultClass) {
         Field[] fields = sourceClass.getDeclaredFields();
-        for(Field field : fields) {
-            if(field.getType().equals(resultClass))
+        for (Field field : fields) {
+            if (field.getType().equals(resultClass))
                 return field;
         }
-        for(Field field : fields) {
-            if(resultClass.isAssignableFrom(field.getType()))
+        for (Field field : fields) {
+            if (resultClass.isAssignableFrom(field.getType()))
                 return field;
         }
         return null;
index 525409b1ce41cc388e297b22e9765f08fcfff50c..ae4420b4fced85133b863f5962eeb5dc612dc685 100644 (file)
@@ -23,11 +23,9 @@ public class StructureType {
     public final static StructureType EndCity = new StructureType(END_CITY);
     public final static StructureType Mansion = new StructureType(MANSION);
 
-
     private final int type;
 
     private StructureType(int type) {
-
         this.type = type;
     }
 
@@ -50,7 +48,7 @@ public class StructureType {
             case END_CITY:
                 return Color.MAGENTA;
             case MANSION:
-                return new Color(139,69,19);
+                return new Color(139, 69, 19);
         }
         return Color.WHITE;
     }
index 3a738b0749c5d974a1b095f8d73700a0b760463a..2a7d217ef084765d5ea5c2aa67483ccc66eb2ae5 100644 (file)
@@ -45,7 +45,7 @@ public class Configuration {
         }
     }
 
-    Map<String, Map<String, Setting>> settingsGroup = new HashMap<String, Map<String, Setting>>();
+    Map<String, Map<String, Setting>> settingsGroup = new HashMap<>();
 
     public void load() {
         try {
@@ -67,7 +67,7 @@ public class Configuration {
                 }
                 if (category == null && trimmedLine.endsWith("{")) {
                     category = trimmedLine.substring(0, trimmedLine.length() - 1).trim();
-                    settingsGroup.put(category, new HashMap<String, Setting>());
+                    settingsGroup.put(category, new HashMap<>());
                     continue;
                 }
                 if (category != null) {
@@ -98,7 +98,7 @@ public class Configuration {
 
     public Setting get(String category, String settingName, Object defaultValue) {
         if (!settingsGroup.containsKey(category)) {
-            settingsGroup.put(category, new HashMap<String, Setting>());
+            settingsGroup.put(category, new HashMap<>());
         }
         Map<String, Setting> settings = settingsGroup.get(category);
         if (!settings.containsKey(settingName)) {
index 7b2f0470e8bc6fb91db3fb6b8a6b7aefbfae57da..f6a7bfc4b8c8352c54fc4e93c48c9bef6e6e1ab3 100644 (file)
@@ -1,12 +1,10 @@
 package com.irtimaled.bbor.config;
 
 public class Setting {
-
     private Object value;
     public String comment;
 
     public Setting(Object value) {
-
         this.value = value;
     }
 
@@ -47,4 +45,4 @@ public class Setting {
     public Object getValue() {
         return value;
     }
-}
\ No newline at end of file
+}
index ef71ff61fc7b60eb317da4ef3cc89ffb24901aa7..764d42f01e8fadb3d91ccc0c460321cfcc13ba0b 100644 (file)
@@ -9,7 +9,6 @@ import net.minecraftforge.fml.common.gameevent.InputEvent;
 import net.minecraftforge.fml.common.network.FMLNetworkEvent;
 
 public class ForgeClientProxy extends ForgeCommonProxy {
-
     private ClientProxy proxy;
 
     @Override
index 24e241e2c1138e974f827d20a9387339bb1f6e00..c204fbf6c785ed3e4144050ab4e5185631c31c47 100644 (file)
@@ -25,10 +25,9 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 public class ForgeCommonProxy implements IEventHandler {
-
-    public Map<EntityPlayerMP, DimensionType> playerDimensions = new ConcurrentHashMap<EntityPlayerMP, DimensionType>();
-    private Map<EntityPlayerMP, Set<BoundingBox>> playerBoundingBoxesCache = new HashMap<EntityPlayerMP, Set<BoundingBox>>();
-    public HashSet<EntityPlayerMP> registeredPlayers = new HashSet<EntityPlayerMP>();
+    public Map<EntityPlayerMP, DimensionType> playerDimensions = new ConcurrentHashMap<>();
+    private Map<EntityPlayerMP, Set<BoundingBox>> playerBoundingBoxesCache = new HashMap<>();
+    public HashSet<EntityPlayerMP> registeredPlayers = new HashSet<>();
 
     protected CommonProxy getProxy() {
         if (commonProxy == null)
@@ -108,7 +107,7 @@ public class ForgeCommonProxy implements IEventHandler {
     public void tickEvent(TickEvent event) {
         for (EntityPlayerMP player : playerDimensions.keySet()) {
             MinecraftServer mc = FMLCommonHandler.instance().getMinecraftServerInstance();
-            if(!mc.getPlayerList().getPlayers().contains(player)) {
+            if (!mc.getPlayerList().getPlayers().contains(player)) {
                 playerDimensions.remove(player);
             } else {
                 DimensionType dimensionType = playerDimensions.get(player);
@@ -124,7 +123,7 @@ public class ForgeCommonProxy implements IEventHandler {
     }
 
     private void sendToPlayer(EntityPlayerMP player, BoundingBoxCache boundingBoxCache) {
-        if(boundingBoxCache == null)
+        if (boundingBoxCache == null)
             return;
         Map<BoundingBox, Set<BoundingBox>> cacheSubset = getBoundingBoxMap(player, boundingBoxCache.getBoundingBoxes());
 
@@ -138,14 +137,14 @@ public class ForgeCommonProxy implements IEventHandler {
             network.sendTo(AddBoundingBoxMessage.from(dimensionType, key, boundingBoxes), player);
 
             if (!playerBoundingBoxesCache.containsKey(player)) {
-                playerBoundingBoxesCache.put(player, new HashSet<BoundingBox>());
+                playerBoundingBoxesCache.put(player, new HashSet<>());
             }
             playerBoundingBoxesCache.get(player).add(key);
         }
     }
 
     private Map<BoundingBox, Set<BoundingBox>> getBoundingBoxMap(EntityPlayerMP player, Map<BoundingBox, Set<BoundingBox>> boundingBoxMap) {
-        Map<BoundingBox, Set<BoundingBox>> cacheSubset = new HashMap<BoundingBox, Set<BoundingBox>>();
+        Map<BoundingBox, Set<BoundingBox>> cacheSubset = new HashMap<>();
         for (BoundingBox key : boundingBoxMap.keySet()) {
             if (!playerBoundingBoxesCache.containsKey(player) || !playerBoundingBoxesCache.get(player).contains(key)) {
                 cacheSubset.put(key, boundingBoxMap.get(key));
index 12dc7127a4f5f8003727dec52fcd72866fefcf5d..27824862f3965a0fdbdd1b3b3a3a14a46240cdc6 100644 (file)
@@ -2,7 +2,6 @@ package com.irtimaled.bbor.forge;
 
 import com.irtimaled.bbor.ConfigManager;
 import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fml.common.FMLCommonHandler;
 import net.minecraftforge.fml.common.Mod;
 import net.minecraftforge.fml.common.SidedProxy;
 import net.minecraftforge.fml.common.event.FMLInitializationEvent;
@@ -11,7 +10,6 @@ import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
 
 @Mod(modid = ForgeMod.MODID, name = ForgeMod.NAME, version = ForgeMod.VERSION, acceptedMinecraftVersions = ForgeMod.MCVERSION, acceptableRemoteVersions = "*")
 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-beta18";
@@ -35,9 +33,6 @@ public class ForgeMod {
     @Mod.EventHandler
     public void load(FMLInitializationEvent evt) {
         MinecraftForge.EVENT_BUS.register(proxy);
-
         proxy.init(configManager);
     }
 }
-
-
index 3ac62dc88cf7dab3c3ff8b9bf7785bac9a0be645..322fe6b97a1ed0e4050ad97f4e1204e3c4be6ed0 100644 (file)
@@ -26,7 +26,7 @@ public class AddBoundingBoxMessage implements IMessage {
     public void fromBytes(ByteBuf buf) {
         dimensionType = DimensionType.getById(ByteBufUtils.readVarInt(buf, 5));
         key = BoundingBoxDeserializer.deserialize(buf);
-        boundingBoxes = new HashSet<BoundingBox>();
+        boundingBoxes = new HashSet<>();
         while (buf.isReadable()) {
             BoundingBox boundingBox = BoundingBoxDeserializer.deserialize(buf);
             boundingBoxes.add(boundingBox);
index 2122aacc9c655319d82b021a543479c2060e6876..37e60278a5648b082f9b625e5304dc6536057ac5 100644 (file)
@@ -11,4 +11,4 @@ public class AddBoundingBoxMessageHandler implements IMessageHandler<AddBounding
         ForgeMod.proxy.addBoundingBox(message.getDimensionType(), message.getKey(), message.getBoundingBoxes());
         return null;
     }
-}
\ No newline at end of file
+}
index ef68c43b67cb28facdb98c02a1da3389639eccc1..53f55c3de28dba1875664984a739a942d1c47862 100644 (file)
@@ -35,7 +35,7 @@ public class BoundingBoxDeserializer {
         int radius = ByteBufUtils.readVarInt(buf, 5);
         boolean spawnsIronGolems = ByteBufUtils.readVarShort(buf) == 1;
         Color color = new Color(ByteBufUtils.readVarInt(buf, 5));
-        Set<BlockPos> doors = new HashSet<BlockPos>();
+        Set<BlockPos> doors = new HashSet<>();
         while (buf.isReadable()) {
             BlockPos door = deserializeBlockPos(buf);
             doors.add(door);
@@ -49,4 +49,4 @@ public class BoundingBoxDeserializer {
         int z = ByteBufUtils.readVarInt(buf, 5);
         return new BlockPos(x, y, z);
     }
-}
\ No newline at end of file
+}
index 8c6bbbe8b8cad727d1192c101a4281c1bf37123c..7c0af0108a11f97e31670ed928c40c0e73c270da 100644 (file)
@@ -10,7 +10,6 @@ import net.minecraftforge.fml.common.network.ByteBufUtils;
 import java.awt.*;
 
 public class BoundingBoxSerializer {
-
     public static void serialize(BoundingBox boundingBox, ByteBuf buf) {
         if (boundingBox instanceof BoundingBoxVillage) {
             serializeVillage((BoundingBoxVillage) boundingBox, buf);
@@ -20,15 +19,13 @@ public class BoundingBoxSerializer {
         }
     }
 
-
     private static void serializeVillage(BoundingBoxVillage boundingBox, ByteBuf buf) {
         ByteBufUtils.writeVarShort(buf, 'V');
         serializeBlockPos(boundingBox.getCenter(), buf);
         ByteBufUtils.writeVarInt(buf, boundingBox.getRadius(), 5);
         ByteBufUtils.writeVarShort(buf, boundingBox.getSpawnsIronGolems() ? 1 : 0);
         serializeColor(boundingBox.getColor(), buf);
-        for(BlockPos door : boundingBox.getDoors())
-        {
+        for (BlockPos door : boundingBox.getDoors()) {
             serializeBlockPos(door, buf);
         }
     }
index b86337d9ee92baf51efc7ce5dc34b97bd8d48d5c..35e2de85341067dc329a6768b28590dcc750b35a 100644 (file)
@@ -5,7 +5,6 @@ import io.netty.buffer.ByteBuf;
 import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
 
 public class InitializeClientMessage implements IMessage {
-
     private WorldData worldData;
 
     public static InitializeClientMessage from(WorldData worldData) {
@@ -14,7 +13,6 @@ public class InitializeClientMessage implements IMessage {
         return message;
     }
 
-
     @Override
     public void fromBytes(ByteBuf buf) {
         long seed = buf.readLong();
index 13eb1f10b033dabd4eb60773e4a1f5fc0c738664..58c972c06112f5b5e95f8b8e8493f7ff44690213 100644 (file)
@@ -8,8 +8,7 @@ import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
 public class RemoveBoundingBoxMessageHandler implements IMessageHandler<RemoveBoundingBoxMessage, IMessage> {
     @Override
     public IMessage onMessage(RemoveBoundingBoxMessage message, MessageContext ctx) {
-
         ForgeMod.proxy.removeBoundingBox(message.getDimensionType(), message.getKey());
         return null;
     }
-}
\ No newline at end of file
+}
diff --git a/resources/pack.mcmeta b/resources/pack.mcmeta
new file mode 100644 (file)
index 0000000..c00c642
--- /dev/null
@@ -0,0 +1,7 @@
+{
+    "pack": {
+        "description": "bbor resources",
+        "pack_format": 3,
+        "_comment": "A pack_format of 3 should be used starting with Minecraft 1.11. All resources, including language files, should be lowercase (eg: en_us.lang). A pack_format of 2 will load your mod resources with LegacyV2Adapter, which requires language files to have uppercase letters (eg: en_US.lang)."
+    }
+}