]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Use correct type for WorldLoad event
authorIrtimaled <irtimaled@gmail.com>
Mon, 18 Mar 2019 05:49:58 +0000 (22:49 -0700)
committerIrtimaled <irtimaled@gmail.com>
Mon, 25 Mar 2019 03:56:28 +0000 (20:56 -0700)
src/main/java/com/irtimaled/bbor/common/CommonProxy.java
src/main/java/com/irtimaled/bbor/common/events/WorldLoaded.java
src/main/java/com/irtimaled/bbor/mixin/server/MixinMinecraftServer.java

index 992df9d8ba497cde325a60919aef2487df9faab2..897e72fab7b229abded1cd9d0388fd8b6373c008 100644 (file)
@@ -11,7 +11,6 @@ import com.irtimaled.bbor.common.messages.InitializeClient;
 import com.irtimaled.bbor.common.messages.PayloadBuilder;
 import com.irtimaled.bbor.common.messages.RemoveBoundingBox;
 import com.irtimaled.bbor.common.models.*;
-import net.minecraft.world.World;
 import net.minecraft.world.WorldServer;
 import net.minecraft.world.chunk.Chunk;
 
@@ -45,25 +44,23 @@ public class CommonProxy {
         worldData = new WorldData(seed, spawnX, spawnZ);
     }
 
-    private void worldLoaded(World world) {
-        if (world instanceof WorldServer) {
-            int dimensionId = world.dimension.getType().getId();
-            BoundingBoxCache boundingBoxCache = getOrCreateCache(dimensionId);
-            ChunkProcessor chunkProcessor = null;
-            if (dimensionId == Dimensions.OVERWORLD) {
-                setWorldData(world.getSeed(), world.getWorldInfo().getSpawnX(), world.getWorldInfo().getSpawnZ());
-                chunkProcessor = new OverworldChunkProcessor(boundingBoxCache);
-            }
-            if (dimensionId == Dimensions.NETHER) {
-                chunkProcessor = new NetherChunkProcessor(boundingBoxCache);
-            }
-            if (dimensionId == Dimensions.THE_END) {
-                chunkProcessor = new EndChunkProcessor(boundingBoxCache);
-            }
-            Logger.info("create world dimension: %s, %s (seed: %d)", dimensionId, world.getClass().toString(), world.getSeed());
-            chunkProcessors.put(dimensionId, chunkProcessor);
-            villageProcessors.put(dimensionId, new VillageProcessor(dimensionId, boundingBoxCache));
+    private void worldLoaded(WorldServer world) {
+        int dimensionId = world.dimension.getType().getId();
+        BoundingBoxCache boundingBoxCache = getOrCreateCache(dimensionId);
+        ChunkProcessor chunkProcessor = null;
+        if (dimensionId == Dimensions.OVERWORLD) {
+            setWorldData(world.getSeed(), world.getWorldInfo().getSpawnX(), world.getWorldInfo().getSpawnZ());
+            chunkProcessor = new OverworldChunkProcessor(boundingBoxCache);
+        }
+        if (dimensionId == Dimensions.NETHER) {
+            chunkProcessor = new NetherChunkProcessor(boundingBoxCache);
+        }
+        if (dimensionId == Dimensions.THE_END) {
+            chunkProcessor = new EndChunkProcessor(boundingBoxCache);
         }
+        Logger.info("create world dimension: %s, %s (seed: %d)", dimensionId, world.getClass().toString(), world.getSeed());
+        chunkProcessors.put(dimensionId, chunkProcessor);
+        villageProcessors.put(dimensionId, new VillageProcessor(dimensionId, boundingBoxCache));
     }
 
     private void chunkLoaded(Chunk chunk) {
index 9c76eca8eabd17ad16ee1620af7b503f32d4ed45..0315004a7faa85376f38ffa75f5978c856b0e43e 100644 (file)
@@ -1,15 +1,15 @@
 package com.irtimaled.bbor.common.events;
 
-import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
 
 public class WorldLoaded {
-    private final World world;
+    private final WorldServer world;
 
-    public WorldLoaded(World world) {
+    public WorldLoaded(WorldServer world) {
         this.world = world;
     }
 
-    public World getWorld() {
+    public WorldServer getWorld() {
         return world;
     }
 }
index 73b7c61f208b4ed3da441f0269877201b991ae84..f43baf83f8105ea8fd5ef7e5dc17b97c5e6dc358 100644 (file)
@@ -4,7 +4,6 @@ import com.irtimaled.bbor.common.EventBus;
 import com.irtimaled.bbor.common.events.ServerTick;
 import com.irtimaled.bbor.common.events.WorldLoaded;
 import net.minecraft.server.MinecraftServer;
-import net.minecraft.world.World;
 import net.minecraft.world.WorldServer;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
@@ -19,7 +18,7 @@ public class MixinMinecraftServer {
 
     @Inject(method = "initialWorldChunkLoad", at = @At("HEAD"))
     private void initialWorldChunkLoad(CallbackInfo ci) {
-        for (World world : worlds) {
+        for (WorldServer world : worlds) {
             EventBus.publish(new WorldLoaded(world));
         }
     }