]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Switch to using Interop classes
authorirtimaled <irtimaled@gmail.com>
Mon, 8 Jul 2019 09:11:50 +0000 (02:11 -0700)
committerIrtimaled <irtimaled@gmail.com>
Sun, 14 Jul 2019 21:12:27 +0000 (14:12 -0700)
Since a lot of the logic in Mixins is identical to that in forge push the code into an interop class for reuse

18 files changed:
src/main/java/com/irtimaled/bbor/client/ClientProxy.java
src/main/java/com/irtimaled/bbor/client/events/SeedCommandTyped.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/interop/ClientInterop.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/mixin/client/MixinMinecraft.java
src/main/java/com/irtimaled/bbor/mixin/client/entity/MixinEntityPlayerSP.java
src/main/java/com/irtimaled/bbor/mixin/client/gui/MixinGuiOptions.java
src/main/java/com/irtimaled/bbor/mixin/client/multiplayer/MixinWorldClient.java
src/main/java/com/irtimaled/bbor/mixin/client/network/MixinNetHandlerLoginClient.java
src/main/java/com/irtimaled/bbor/mixin/client/network/MixinNetHandlerPlayClient.java
src/main/java/com/irtimaled/bbor/mixin/client/renderer/MixinEntityRenderer.java
src/main/java/com/irtimaled/bbor/mixin/client/settings/MixinGameSettings.java
src/main/java/com/irtimaled/bbor/mixin/server/MixinMinecraftServer.java
src/main/java/com/irtimaled/bbor/mixin/server/dedicated/MixinDedicatedServer.java
src/main/java/com/irtimaled/bbor/mixin/server/management/MixinPlayerInteractionManager.java
src/main/java/com/irtimaled/bbor/mixin/server/management/MixinPlayerList.java
src/main/java/com/irtimaled/bbor/mixin/world/MixinWorldServer.java
src/main/java/com/irtimaled/bbor/mixin/world/chunk/MixinChunk.java

index c41da42758bc734dfa1bab45e9e9003b46f0fe35..1df521c6dcd8f16c2687d38e9582bb351974a487 100644 (file)
@@ -24,16 +24,6 @@ public class ClientProxy extends CommonProxy {
                 .onKeyPressHandler(ClientProxy::toggleOuterBoxesOnly);
     }
 
-    private static ClientProxy instance;
-    public static ClientProxy getInstance() {
-        if(instance == null)
-            instance = new ClientProxy();
-        return instance;
-    }
-
-    private ClientProxy() {
-    }
-
     private boolean ready;
 
     public static void toggleActive() {
@@ -59,6 +49,7 @@ public class ClientProxy extends CommonProxy {
         EventBus.subscribe(AddBoundingBoxReceived.class, this::addBoundingBox);
         EventBus.subscribe(RemoveBoundingBoxReceived.class, this::onRemoveBoundingBoxReceived);
         EventBus.subscribe(UpdateWorldSpawnReceived.class, this::onUpdateWorldSpawnReceived);
+        EventBus.subscribe(SeedCommandTyped.class, this::onSeedCommandTyped);
 
         renderer = new ClientRenderer(this::getCache);
         KeyListener.init();
@@ -109,6 +100,10 @@ public class ClientProxy extends CommonProxy {
         setSeed(seed);
     }
 
+    private void onSeedCommandTyped(SeedCommandTyped event) {
+        setSeed(event.getSeed());
+    }
+
     @Override
     public void setSeed(long seed) {
         super.setSeed(seed);
diff --git a/src/main/java/com/irtimaled/bbor/client/events/SeedCommandTyped.java b/src/main/java/com/irtimaled/bbor/client/events/SeedCommandTyped.java
new file mode 100644 (file)
index 0000000..d4bdc15
--- /dev/null
@@ -0,0 +1,13 @@
+package com.irtimaled.bbor.client.events;
+
+public class SeedCommandTyped {
+    private final Long seed;
+
+    public SeedCommandTyped(Long seed) {
+        this.seed = seed;
+    }
+
+    public Long getSeed() {
+        return seed;
+    }
+}
diff --git a/src/main/java/com/irtimaled/bbor/client/interop/ClientInterop.java b/src/main/java/com/irtimaled/bbor/client/interop/ClientInterop.java
new file mode 100644 (file)
index 0000000..33880b8
--- /dev/null
@@ -0,0 +1,53 @@
+package com.irtimaled.bbor.client.interop;
+
+import com.irtimaled.bbor.client.PlayerCoords;
+import com.irtimaled.bbor.client.events.ConnectedToRemoteServer;
+import com.irtimaled.bbor.client.events.DisconnectedFromRemoteServer;
+import com.irtimaled.bbor.client.events.Render;
+import com.irtimaled.bbor.client.events.SeedCommandTyped;
+import com.irtimaled.bbor.common.EventBus;
+import com.irtimaled.bbor.common.TypeHelper;
+import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.network.NetworkManager;
+
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+
+public class ClientInterop {
+    public static void connectedToRemoteServer(NetworkManager networkManager) {
+        SocketAddress remoteAddress = networkManager.getRemoteAddress();
+        TypeHelper.doIfType(remoteAddress, InetSocketAddress.class, inetSocketAddress -> EventBus.publish(new ConnectedToRemoteServer(inetSocketAddress)));
+    }
+
+    public static void disconnectedFromRemoteServer() {
+        EventBus.publish(new DisconnectedFromRemoteServer());
+    }
+
+    public static void render(float partialTicks, EntityPlayerSP player) {
+        PlayerCoords.setPlayerPosition(partialTicks, player);
+        EventBus.publish(new Render(player.dimension));
+    }
+
+    public static boolean interceptChatMessage(String message) {
+        if (message.startsWith("/bbor:seed")) {
+            if (message.length() > 11) {
+                String argument = message.substring(11);
+                Long seed = parseNumericSeed(argument);
+                if (seed == null) {
+                    seed = (long) argument.hashCode();
+                }
+                EventBus.publish(new SeedCommandTyped(seed));
+            }
+            return true;
+        }
+        return false;
+    }
+
+    private static Long parseNumericSeed(String argument) {
+        try {
+            return Long.parseLong(argument);
+        } catch (final NumberFormatException ex) {
+            return null;
+        }
+    }
+}
diff --git a/src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java b/src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java
new file mode 100644 (file)
index 0000000..b5d6b16
--- /dev/null
@@ -0,0 +1,62 @@
+package com.irtimaled.bbor.common.interop;
+
+import com.irtimaled.bbor.common.EventBus;
+import com.irtimaled.bbor.common.events.*;
+import com.irtimaled.bbor.common.models.Coords;
+import com.irtimaled.bbor.common.models.ServerPlayer;
+import com.irtimaled.bbor.config.ConfigManager;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockMobSpawner;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.network.NetHandlerPlayServer;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+import net.minecraft.world.WorldServer;
+import net.minecraft.world.chunk.Chunk;
+
+import java.io.File;
+
+public class CommonInterop {
+    public static void init() {
+        ConfigManager.loadConfig(new File("."));
+    }
+
+    public static void chunkLoaded(Chunk chunk) {
+        EventBus.publish(new ChunkLoaded(chunk));
+    }
+
+    public static void loadWorlds(WorldServer[] worlds) {
+        for (WorldServer world : worlds) {
+            EventBus.publish(new WorldLoaded(world));
+        }
+    }
+
+    public static void tick() {
+        EventBus.publish(new ServerTick());
+    }
+
+    public static void worldTick(WorldServer worldServer) {
+        EventBus.publish(new ServerWorldTick(worldServer));
+    }
+
+    public static void playerLoggedIn(EntityPlayerMP player) {
+        NetHandlerPlayServer connection = player.connection;
+        if (connection == null) return;
+
+        NetworkManager networkManager = connection.netManager;
+        if (networkManager.isLocalChannel()) return;
+
+        EventBus.publish(new PlayerLoggedIn(new ServerPlayer(player)));
+    }
+
+    public static void playerLoggedOut(EntityPlayerMP player) {
+        EventBus.publish(new PlayerLoggedOut(new ServerPlayer(player)));
+    }
+
+    public static void tryHarvestBlock(Block block, BlockPos pos, World world) {
+        if(block instanceof BlockMobSpawner) {
+            EventBus.publish(new MobSpawnerBroken(world.dimension.getType().getId(), new Coords(pos)));
+        }
+    }
+}
index 4647c6d427bc8de11eafb4236b5569113955d43d..3bde9db961e68b065e12616b61b22d9a43c8ed3b 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.mixin.client;
 
 import com.irtimaled.bbor.client.ClientProxy;
-import com.irtimaled.bbor.config.ConfigManager;
+import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.main.GameConfiguration;
 import org.spongepowered.asm.mixin.Mixin;
@@ -15,8 +15,8 @@ public class MixinMinecraft {
 
     @Inject(method = "<init>", at = @At("RETURN"))
     private void constructor(GameConfiguration configuration, CallbackInfo ci) {
-        ConfigManager.loadConfig(configuration.folderInfo.gameDir);
-        clientProxy = ClientProxy.getInstance();
+        CommonInterop.init();
+        clientProxy = new ClientProxy();
     }
 
     @Inject(method = "init", at = @At("RETURN"))
index 98f445b6063c0ccb73228641e85e618efec9ce89..1e9ad4992aa8481559bcb9ee7c021b87d282ecc4 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor.mixin.client.entity;
 
-import com.irtimaled.bbor.client.ClientProxy;
+import com.irtimaled.bbor.client.interop.ClientInterop;
 import net.minecraft.client.entity.EntityPlayerSP;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
@@ -11,24 +11,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 public abstract class MixinEntityPlayerSP {
     @Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
     private void sendChatMessage(String message, CallbackInfo ci) {
-        if(message.startsWith("/bbor:seed")) {
-            if(message.length()<11) return;
-
-            String argument = message.substring(11);
-            Long seed = parseNumericSeed(argument);
-            if(seed == null) {
-                seed = (long) argument.hashCode();
-            }
-            ClientProxy.getInstance().setSeed(seed);
+        if(ClientInterop.interceptChatMessage(message))
             ci.cancel();
-        }
-    }
-
-    private Long parseNumericSeed(String argument) {
-        try {
-            return Long.parseLong(argument);
-        } catch (final NumberFormatException ex) {
-           return null;
-        }
     }
 }
index 66dd298980847cb2192b385ca803144a91e0eba1..cba5640805793e985adeb12ad300236f977e1f3a 100644 (file)
@@ -20,6 +20,6 @@ public class MixinGuiOptions extends GuiScreen {
             if (button.y >= top && button.y < bottom)
                 button.y -= 12;
         }
-        this.addButton(new SettingsScreenButton(200, this.width / 2 - 155, top + 84, 150, "BBOR", this));
+        this.addButton(new SettingsScreenButton(199, this.width / 2 - 155, top + 84, 150, "BBOR", this));
     }
 }
index 4c97618ddabaa42eb7cf90eeb47e133e905c0508..d6f77fcbdbecfd9dd4ea3b59d865f0a4cf344ac6 100644 (file)
@@ -1,7 +1,6 @@
 package com.irtimaled.bbor.mixin.client.multiplayer;
 
-import com.irtimaled.bbor.client.events.DisconnectedFromRemoteServer;
-import com.irtimaled.bbor.common.EventBus;
+import com.irtimaled.bbor.client.interop.ClientInterop;
 import net.minecraft.client.multiplayer.WorldClient;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
@@ -12,6 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 public class MixinWorldClient {
     @Inject(method = "sendQuittingDisconnectingPacket", at = @At("RETURN"))
     private void sendQuittingDisconnectingPacket(CallbackInfo ci) {
-        EventBus.publish(new DisconnectedFromRemoteServer());
+        ClientInterop.disconnectedFromRemoteServer();
     }
 }
index 552855a1eb88202a0bf56f8c692ca7a8fb781ce3..e4d462bdcee95870d03331861e47ad0eb9e590b4 100644 (file)
@@ -1,9 +1,6 @@
 package com.irtimaled.bbor.mixin.client.network;
 
-import com.irtimaled.bbor.client.events.ConnectedToRemoteServer;
-import com.irtimaled.bbor.client.events.DisconnectedFromRemoteServer;
-import com.irtimaled.bbor.common.EventBus;
-import com.irtimaled.bbor.common.TypeHelper;
+import com.irtimaled.bbor.client.interop.ClientInterop;
 import net.minecraft.client.network.NetHandlerLoginClient;
 import net.minecraft.network.NetworkManager;
 import org.spongepowered.asm.mixin.Final;
@@ -13,9 +10,6 @@ import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-
 @Mixin(NetHandlerLoginClient.class)
 public abstract class MixinNetHandlerLoginClient {
     @Shadow
@@ -24,14 +18,11 @@ public abstract class MixinNetHandlerLoginClient {
 
     @Inject(method = "handleLoginSuccess", at = @At(value = "RETURN"))
     private void handleLoginSuccess(CallbackInfo ci) {
-        SocketAddress remoteAddress = this.networkManager.getRemoteAddress();
-        TypeHelper.doIfType(remoteAddress, InetSocketAddress.class, inetSocketAddress -> {
-            EventBus.publish(new ConnectedToRemoteServer(inetSocketAddress));
-        });
+        ClientInterop.connectedToRemoteServer(networkManager);
     }
 
     @Inject(method = "onDisconnect", at = @At("HEAD"))
     private void onDisconnect(CallbackInfo ci) {
-        EventBus.publish(new DisconnectedFromRemoteServer());
+        ClientInterop.disconnectedFromRemoteServer();
     }
 }
index bc79776a6ceb656ac39798e4f43bec2e594ae0c8..6f8e1a08be88d3cc753a95c7dffac823f64d5139 100644 (file)
@@ -1,7 +1,6 @@
 package com.irtimaled.bbor.mixin.client.network;
 
-import com.irtimaled.bbor.client.events.DisconnectedFromRemoteServer;
-import com.irtimaled.bbor.common.EventBus;
+import com.irtimaled.bbor.client.interop.ClientInterop;
 import net.minecraft.client.network.NetHandlerPlayClient;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
@@ -12,6 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 public class MixinNetHandlerPlayClient {
     @Inject(method = "onDisconnect", at = @At("HEAD"))
     private void onDisconnect(CallbackInfo ci) {
-        EventBus.publish(new DisconnectedFromRemoteServer());
+        ClientInterop.disconnectedFromRemoteServer();
     }
 }
index e44d302cada025febd3ab46382b533e541dec01e..44f66c1197d2b36a745b1f46e991e8e502f85758 100644 (file)
@@ -1,10 +1,7 @@
 package com.irtimaled.bbor.mixin.client.renderer;
 
-import com.irtimaled.bbor.client.PlayerCoords;
-import com.irtimaled.bbor.client.events.Render;
-import com.irtimaled.bbor.common.EventBus;
+import com.irtimaled.bbor.client.interop.ClientInterop;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityPlayerSP;
 import net.minecraft.client.renderer.EntityRenderer;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
@@ -21,8 +18,6 @@ public class MixinEntityRenderer {
 
     @Inject(method = "updateCameraAndRender(FJ)V", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V", args = "ldc=hand", shift = At.Shift.BEFORE))
     private void render(float partialTicks, long ignored, CallbackInfo ci) {
-        EntityPlayerSP player = this.mc.player;
-        PlayerCoords.setPlayerPosition(partialTicks, player);
-        EventBus.publish(new Render(player.dimension));
+        ClientInterop.render(partialTicks, this.mc.player);
     }
 }
index 2f60067ecfc368d3052cddc243ffd8c7e61cb7c3..71d3b7efa6cfce4f7416b2598066fdd22824a310 100644 (file)
@@ -21,18 +21,9 @@ public abstract class MixinGameSettings {
     @Shadow
     public abstract void loadOptions();
 
-    @Inject(method = "<init>()V", at = @At("RETURN"))
-    private void init(CallbackInfo ci) {
-        keyBindings = getKeysAll();
-    }
-
-    private KeyBinding[] getKeysAll() {
-        return ArrayUtils.addAll(keyBindings, KeyListener.keyBindings());
-    }
-
     @Inject(method = "<init>(Lnet/minecraft/client/Minecraft;Ljava/io/File;)V", at = @At("RETURN"))
     private void init(Minecraft minecraft, File file, CallbackInfo ci) {
-        keyBindings = getKeysAll();
+        keyBindings = ArrayUtils.addAll(keyBindings, KeyListener.keyBindings());
         this.loadOptions();
     }
 }
index f43baf83f8105ea8fd5ef7e5dc17b97c5e6dc358..6c2a90d72aaa635fdd41d53dbd16ca5daabed1c5 100644 (file)
@@ -1,8 +1,6 @@
 package com.irtimaled.bbor.mixin.server;
 
-import com.irtimaled.bbor.common.EventBus;
-import com.irtimaled.bbor.common.events.ServerTick;
-import com.irtimaled.bbor.common.events.WorldLoaded;
+import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.server.MinecraftServer;
 import net.minecraft.world.WorldServer;
 import org.spongepowered.asm.mixin.Mixin;
@@ -18,13 +16,11 @@ public class MixinMinecraftServer {
 
     @Inject(method = "initialWorldChunkLoad", at = @At("HEAD"))
     private void initialWorldChunkLoad(CallbackInfo ci) {
-        for (WorldServer world : worlds) {
-            EventBus.publish(new WorldLoaded(world));
-        }
+        CommonInterop.loadWorlds(worlds);
     }
 
     @Inject(method = "tick", at = @At("RETURN"))
     private void tick(CallbackInfo ci) {
-        EventBus.publish(new ServerTick());
+        CommonInterop.tick();
     }
 }
index dd2074060dc6e4b3c0fe213cf47c3947f1c3fe7e..983def31b44378c2a440b4d549176291d4ac1e3b 100644 (file)
@@ -1,20 +1,18 @@
 package com.irtimaled.bbor.mixin.server.dedicated;
 
 import com.irtimaled.bbor.common.CommonProxy;
-import com.irtimaled.bbor.config.ConfigManager;
+import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.server.dedicated.DedicatedServer;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
 
-import java.io.File;
-
 @Mixin(DedicatedServer.class)
 public class MixinDedicatedServer {
     @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/dedicated/DedicatedServer;loadAllWorlds(Ljava/lang/String;Ljava/lang/String;JLnet/minecraft/world/WorldType;Lcom/google/gson/JsonElement;)V"))
     private void init(CallbackInfoReturnable<Boolean> cir) {
-        ConfigManager.loadConfig(new File("."));
+        CommonInterop.init();
         new CommonProxy().init();
     }
 }
index 32d710d5cbe7b22f3ebc20f0996544543aec0f4a..09a54804b4dabcab43963679b010e7b92d88ccdb 100644 (file)
@@ -1,11 +1,7 @@
 package com.irtimaled.bbor.mixin.server.management;
 
-import com.irtimaled.bbor.common.EventBus;
-import com.irtimaled.bbor.common.TypeHelper;
-import com.irtimaled.bbor.common.events.MobSpawnerBroken;
-import com.irtimaled.bbor.common.models.Coords;
+import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.block.Block;
-import net.minecraft.block.BlockMobSpawner;
 import net.minecraft.server.management.PlayerInteractionManager;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.World;
@@ -23,7 +19,6 @@ public class MixinPlayerInteractionManager {
     @Inject(method = "tryHarvestBlock", at = @At("HEAD"))
     private void tryHarvestBlock(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
         Block block = this.world.getBlockState(pos).getBlock();
-        TypeHelper.doIfType(block, BlockMobSpawner.class, ms ->
-                EventBus.publish(new MobSpawnerBroken(this.world.dimension.getType().getId(), new Coords(pos))));
+        CommonInterop.tryHarvestBlock(block, pos, world);
     }
 }
index ecc23148fb49344330bfa739b55ec804e7d20a33..6eeb201d8b8377b3e079f0938d81891e5faf86cd 100644 (file)
@@ -1,11 +1,6 @@
 package com.irtimaled.bbor.mixin.server.management;
 
-import com.irtimaled.bbor.common.EventBus;
-import com.irtimaled.bbor.common.TypeHelper;
-import com.irtimaled.bbor.common.events.PlayerLoggedIn;
-import com.irtimaled.bbor.common.events.PlayerLoggedOut;
-import com.irtimaled.bbor.common.models.ServerPlayer;
-import io.netty.channel.local.LocalAddress;
+import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.entity.player.EntityPlayerMP;
 import net.minecraft.server.management.PlayerList;
 import org.spongepowered.asm.mixin.Mixin;
@@ -17,12 +12,11 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 public class MixinPlayerList {
     @Inject(method = "playerLoggedIn", at = @At("RETURN"))
     private void playerLoggedIn(EntityPlayerMP player, CallbackInfo ci) {
-        if (TypeHelper.as(player.connection.netManager.getRemoteAddress(), LocalAddress.class) != null) return;
-        EventBus.publish(new PlayerLoggedIn(new ServerPlayer(player)));
+        CommonInterop.playerLoggedIn(player);
     }
 
     @Inject(method = "playerLoggedOut", at = @At("HEAD"))
     private void playerLoggedOut(EntityPlayerMP player, CallbackInfo ci) {
-        EventBus.publish(new PlayerLoggedOut(new ServerPlayer(player)));
+        CommonInterop.playerLoggedOut(player);
     }
 }
index 064f85ddea9874f71a0aa8d8a1a59b056c666d84..99fbfde085bece3e5c2cd80742beaf47e85d8962 100644 (file)
@@ -1,7 +1,6 @@
 package com.irtimaled.bbor.mixin.world;
 
-import com.irtimaled.bbor.common.EventBus;
-import com.irtimaled.bbor.common.events.ServerWorldTick;
+import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.world.WorldServer;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
@@ -12,6 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 public class MixinWorldServer {
     @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/village/VillageCollection;tick()V", shift = At.Shift.AFTER))
     private void afterVillageTick(CallbackInfo ci) {
-        EventBus.publish(new ServerWorldTick((WorldServer) (Object) this));
+        CommonInterop.worldTick((WorldServer) (Object) this);
     }
 }
index 0dc7c872d006569ac0fd0817646fde98800c96b7..7eb047611553c518632b5e9f0b34ae917b1b8047 100644 (file)
@@ -1,7 +1,6 @@
 package com.irtimaled.bbor.mixin.world.chunk;
 
-import com.irtimaled.bbor.common.EventBus;
-import com.irtimaled.bbor.common.events.ChunkLoaded;
+import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.world.chunk.Chunk;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
@@ -12,6 +11,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 public class MixinChunk {
     @Inject(method = "onLoad", at = @At("RETURN"))
     private void onLoad(CallbackInfo ci) {
-        EventBus.publish(new ChunkLoaded((Chunk) (Object) this));
+        CommonInterop.chunkLoaded((Chunk) (Object) this);
     }
 }