]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Update for 1.14
authorirtimaled <irtimaled@gmail.com>
Wed, 6 Feb 2019 18:58:28 +0000 (10:58 -0800)
committerIrtimaled <irtimaled@gmail.com>
Wed, 21 Aug 2019 04:38:29 +0000 (21:38 -0700)
56 files changed:
gradle.properties
src/main/java/com/irtimaled/bbor/Main.java
src/main/java/com/irtimaled/bbor/client/CameraCoords.java [new file with mode: 0644]
src/main/java/com/irtimaled/bbor/client/ClientProxy.java
src/main/java/com/irtimaled/bbor/client/ClientRenderer.java
src/main/java/com/irtimaled/bbor/client/PlayerCoords.java
src/main/java/com/irtimaled/bbor/client/gui/AbstractButton.java
src/main/java/com/irtimaled/bbor/client/gui/AbstractSlider.java
src/main/java/com/irtimaled/bbor/client/gui/BoolSettingButton.java
src/main/java/com/irtimaled/bbor/client/gui/BoundingBoxTypeButton.java
src/main/java/com/irtimaled/bbor/client/gui/CreateControl.java
src/main/java/com/irtimaled/bbor/client/gui/IntSettingSlider.java
src/main/java/com/irtimaled/bbor/client/gui/MaxYSettingSlider.java
src/main/java/com/irtimaled/bbor/client/gui/SettingsScreen.java
src/main/java/com/irtimaled/bbor/client/gui/SettingsScreenButton.java
src/main/java/com/irtimaled/bbor/client/interop/ClientInterop.java
src/main/java/com/irtimaled/bbor/client/keyboard/KeyListener.java
src/main/java/com/irtimaled/bbor/client/renderers/MobSpawnerRenderer.java
src/main/java/com/irtimaled/bbor/client/renderers/OffsetPoint.java
src/main/java/com/irtimaled/bbor/client/renderers/VillageRenderer.java [deleted file]
src/main/java/com/irtimaled/bbor/common/BoundingBoxType.java
src/main/java/com/irtimaled/bbor/common/CommonProxy.java
src/main/java/com/irtimaled/bbor/common/VillageColorCache.java [deleted file]
src/main/java/com/irtimaled/bbor/common/VillageHelper.java [deleted file]
src/main/java/com/irtimaled/bbor/common/VillageProcessor.java [deleted file]
src/main/java/com/irtimaled/bbor/common/chunkProcessors/AbstractChunkProcessor.java
src/main/java/com/irtimaled/bbor/common/events/ServerWorldTick.java [deleted file]
src/main/java/com/irtimaled/bbor/common/events/VillageRemoved.java [deleted file]
src/main/java/com/irtimaled/bbor/common/events/WorldLoaded.java
src/main/java/com/irtimaled/bbor/common/interop/CommonInterop.java
src/main/java/com/irtimaled/bbor/common/messages/BoundingBoxDeserializer.java
src/main/java/com/irtimaled/bbor/common/messages/BoundingBoxSerializer.java
src/main/java/com/irtimaled/bbor/common/messages/PayloadBuilder.java
src/main/java/com/irtimaled/bbor/common/models/BoundingBoxVillage.java [deleted file]
src/main/java/com/irtimaled/bbor/common/models/ServerPlayer.java
src/main/java/com/irtimaled/bbor/config/ConfigManager.java
src/main/java/com/irtimaled/bbor/launch/ClientTweaker.java
src/main/java/com/irtimaled/bbor/launch/Tweaker.java
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/network/play/client/MixinCPacketCustomPayload.java
src/main/java/com/irtimaled/bbor/mixin/network/play/server/MixinSPacketCustomPayload.java
src/main/java/com/irtimaled/bbor/mixin/network/play/server/MixinSPacketSpawnPosition.java
src/main/java/com/irtimaled/bbor/mixin/server/MixinMinecraftServer.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 [deleted file]
src/main/java/com/irtimaled/bbor/mixin/world/chunk/MixinChunk.java
src/main/java/com/irtimaled/bbor/server/ServerRunner.java
src/main/resources/mixins.bbor.json

index 02c781668a83cbee95a6534bef602be9113de3ad..cc9eb5cfae697f6f62ddbebbe3abffc95f20e17b 100644 (file)
@@ -1,4 +1,4 @@
 name=bbor
 buildVersion=1.0.13
 # leave a space to reduce merge conflicts on version change
-mcVersion=1.13.2
+mcVersion=1.14
index 0449b17ae7f08e9f862d69072469fda68685c1ff..4d706b6cd6ca9805b056d6f4561f09d1c6bf8516 100644 (file)
@@ -12,7 +12,6 @@ public class Main {
             ServerRunner.run("@MC_VERSION@", Arrays.asList(args).subList(1, args.length));
         } else {
             Installer.install("@VERSION@", "@MC_VERSION@");
-
         }
     }
 }
diff --git a/src/main/java/com/irtimaled/bbor/client/CameraCoords.java b/src/main/java/com/irtimaled/bbor/client/CameraCoords.java
new file mode 100644 (file)
index 0000000..86bddaa
--- /dev/null
@@ -0,0 +1,22 @@
+package com.irtimaled.bbor.client;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.math.Vec3d;
+
+public class CameraCoords {
+    private static Vec3d getCameraPos() {
+        return Minecraft.getInstance().gameRenderer.func_215316_n().func_216785_c();
+    }
+
+    public static double getX() {
+        return getCameraPos().x;
+    }
+
+    public static double getY() {
+        return getCameraPos().y;
+    }
+
+    public static double getZ() {
+        return getCameraPos().z;
+    }
+}
index b446afca112900a73b7175dc42e8cb3d7175daed..c9a98bfcb3ee1d09311e453fe4620bef5997ad4f 100644 (file)
@@ -6,7 +6,6 @@ import com.irtimaled.bbor.client.keyboard.KeyListener;
 import com.irtimaled.bbor.common.BoundingBoxCache;
 import com.irtimaled.bbor.common.CommonProxy;
 import com.irtimaled.bbor.common.EventBus;
-import com.irtimaled.bbor.common.VillageColorCache;
 import com.irtimaled.bbor.config.ConfigManager;
 import com.irtimaled.bbor.config.Setting;
 
@@ -62,7 +61,6 @@ public class ClientProxy extends CommonProxy {
         active = false;
         if (ConfigManager.keepCacheBetweenSessions.get()) return;
         ready = false;
-        VillageColorCache.clear();
         clearCaches();
         renderer.clear();
     }
index 40d4386f64fd93cb4d6061db8e399b4788aae9b2..acf07df895d1e1e8b58d6fb49bfcad5eb7b02e58 100644 (file)
@@ -22,7 +22,6 @@ public class ClientRenderer {
 
     ClientRenderer(GetCache getCache) {
         this.getCache = getCache;
-        boundingBoxRendererMap.put(BoundingBoxVillage.class, new VillageRenderer());
         boundingBoxRendererMap.put(BoundingBoxSlimeChunk.class, new SlimeChunkRenderer());
         boundingBoxRendererMap.put(BoundingBoxWorldSpawn.class, new WorldSpawnRenderer());
         boundingBoxRendererMap.put(BoundingBoxStructure.class, new StructureRenderer());
index a96924a25daeebb47ec3fdd814bc6682510cce38..d0d2273f451fcced839c71f983c6bfdd66bb1cd0 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor.client;
 
-import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.PlayerEntity;
 
 public class PlayerCoords {
     private static double x;
@@ -8,7 +8,7 @@ public class PlayerCoords {
     private static double z;
     private static double activeY;
 
-    public static void setPlayerPosition(double partialTicks, EntityPlayer entityPlayer) {
+    public static void setPlayerPosition(double partialTicks, PlayerEntity entityPlayer) {
         x = entityPlayer.lastTickPosX + (entityPlayer.posX - entityPlayer.lastTickPosX) * partialTicks;
         y = entityPlayer.lastTickPosY + (entityPlayer.posY - entityPlayer.lastTickPosY) * partialTicks;
         z = entityPlayer.lastTickPosZ + (entityPlayer.posZ - entityPlayer.lastTickPosZ) * partialTicks;
index 234199171bedc1b92b84b02e411821ae01b3c807..4999f783a73f68ff3350b9ebaad2e62d28f55d5d 100644 (file)
@@ -1,16 +1,16 @@
 package com.irtimaled.bbor.client.gui;
 
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.widget.Widget;
 
-abstract class AbstractButton extends GuiButton implements IRenderableControl {
-    AbstractButton(int id, int x, int y, int width, String name) {
-        super(id, x, y, width, 20, name);
+abstract class AbstractButton extends Widget implements IRenderableControl {
+    AbstractButton(int x, int y, int width, String name) {
+        super(x, y, width, 20, name);
     }
 
-    AbstractButton(int id, int x, int y, int width, String name, boolean enabled) {
-        this(id, x, y, width, name);
-        this.enabled = enabled;
+    AbstractButton(int x, int y, int width, String name, boolean enabled) {
+        this(x, y, width, name);
+        this.active = enabled;
     }
 
     @Override
@@ -19,7 +19,7 @@ abstract class AbstractButton extends GuiButton implements IRenderableControl {
     }
 
     @Override
-    protected void renderBg(Minecraft p_renderBg_1_, int p_renderBg_2_, int p_renderBg_3_) {
+    protected void renderBg(Minecraft minecraft, int mouseX, int mouseY) {
         renderBackground();
     }
 
@@ -27,12 +27,12 @@ abstract class AbstractButton extends GuiButton implements IRenderableControl {
     }
 
     @Override
-    protected int getHoverState(boolean p_getHoverState_1_) {
+    protected int getYImage(boolean hovered) {
         return getState();
     }
 
     protected int getState() {
-        return this.enabled ? this.hovered ? 2 : 1 : 0;
+        return this.active ? this.isHovered() ? 2 : 1 : 0;
     }
 
     @Override
index 059ce943e642c636bad7d35804bca769f320ceaa..ab2736625b8349e0087749bd8088df62bc3579d0 100644 (file)
@@ -1,15 +1,15 @@
 package com.irtimaled.bbor.client.gui;
 
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiButton;
+import net.minecraft.client.gui.widget.Widget;
 import net.minecraft.util.math.MathHelper;
 import org.lwjgl.opengl.GL11;
 
-abstract class AbstractSlider extends GuiButton implements IRenderableControl {
+abstract class AbstractSlider extends Widget implements IRenderableControl {
     double progress;
 
-    AbstractSlider(int id, int x, int y, int width) {
-        super(id, x, y, width, 20, "");
+    AbstractSlider(int x, int y, int width) {
+        super(x, y, width, 20, "");
     }
 
     @Override
@@ -19,10 +19,10 @@ abstract class AbstractSlider extends GuiButton implements IRenderableControl {
 
     @Override
     protected void renderBg(Minecraft minecraft, int mouseX, int mouseY) {
-        minecraft.getTextureManager().bindTexture(BUTTON_TEXTURES);
+        minecraft.getTextureManager().bindTexture(WIDGETS_LOCATION);
         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
-        this.drawTexturedModalRect(this.x + (int) (this.progress * (double) (this.width - 8)), this.y, 0, 66, 4, 20);
-        this.drawTexturedModalRect(this.x + (int) (this.progress * (double) (this.width - 8)) + 4, this.y, 196, 66, 4, 20);
+        this.blit(this.x + (int) (this.progress * (double) (this.width - 8)), this.y, 0, 66, 4, 20);
+        this.blit(this.x + (int) (this.progress * (double) (this.width - 8)) + 4, this.y, 196, 66, 4, 20);
     }
 
     boolean setProgress(double progress) {
@@ -42,7 +42,7 @@ abstract class AbstractSlider extends GuiButton implements IRenderableControl {
     }
 
     @Override
-    protected int getHoverState(boolean hovered) {
+    protected int getYImage(boolean hovered) {
         return 0;
     }
 
index 363e67bcdb8970ac1b3b3dc6632ba9ace016e3e2..2b547ace46cabdc94787070153e538d0030a1c8a 100644 (file)
@@ -5,14 +5,14 @@ import com.irtimaled.bbor.config.Setting;
 public class BoolSettingButton extends AbstractButton {
     private final Setting<Boolean> setting;
 
-    BoolSettingButton(int id, int x, int y, int width, String label, Setting<Boolean> setting) {
-        super(id, x, y, width, label);
+    BoolSettingButton(int x, int y, int width, String label, Setting<Boolean> setting) {
+        super(x, y, width, label);
         this.setting = setting;
     }
 
     @Override
     protected int getState() {
-        return enabled ? setting.get() ? 2 : 1 : 0;
+        return active ? setting.get() ? 2 : 1 : 0;
     }
 
     @Override
index d44f0586852793442903bf077e70ac5f8dddb07e..73be02dc3704546b1cac31c9cc9bc168d9ef76d8 100644 (file)
@@ -7,19 +7,19 @@ import java.awt.*;
 public class BoundingBoxTypeButton extends BoolSettingButton {
     private final Color color;
 
-    BoundingBoxTypeButton(int id, int x, int y, int width, String label, BoundingBoxType type) {
-        super(id, x, y, width, label, type.shouldRenderSetting);
+    BoundingBoxTypeButton(int x, int y, int width, String label, BoundingBoxType type) {
+        super(x, y, width, label, type.shouldRenderSetting);
         color = type.getColor();
     }
 
     public BoundingBoxTypeButton(int id, int x, int y, int width, String label, BoundingBoxType type, boolean enabled) {
-        this(id, x, y, width, label, type);
-        this.enabled = enabled;
+        this(x, y, width, label, type);
+        this.active = enabled;
     }
 
     @Override
     protected void renderBackground() {
-        if (!enabled) return;
+        if (!active) return;
 
         int left = x + 1;
         int top = y + 1;
@@ -42,6 +42,6 @@ public class BoundingBoxTypeButton extends BoolSettingButton {
     }
 
     private void drawRectangle(int left, int top, int right, int bottom, Color color) {
-        drawRect(left, top, right, bottom, color.getRGB());
+        fill(left, top, right, bottom, color.getRGB());
     }
 }
index 8dd7827a4d2ec110413eee97d43a57376aa56b34..6549c82f3f1bb202e3d616bc202f9874144f6add 100644 (file)
@@ -2,5 +2,5 @@ package com.irtimaled.bbor.client.gui;
 
 @FunctionalInterface
 interface CreateControl {
-    IControl create(Integer id, Integer x, Integer y, Integer width);
+    IControl create(Integer x, Integer y, Integer width);
 }
index edc724f49a40627e5975fc7d9b03677f4184e4d0..5500cd37cc9180523ba883c44576770412471a8d 100644 (file)
@@ -13,8 +13,8 @@ class IntSettingSlider extends AbstractSlider implements IRenderableControl {
     final int minValue;
     final int range;
 
-    IntSettingSlider(int id, int x, int y, int width, int minValue, int maxValue, String prefix, Setting<Integer> setting) {
-        super(id, x, y, width);
+    IntSettingSlider(int x, int y, int width, int minValue, int maxValue, String prefix, Setting<Integer> setting) {
+        super(x, y, width);
         this.setting = setting;
         this.minValue = minValue;
         this.prefix = prefix;
@@ -46,7 +46,7 @@ class IntSettingSlider extends AbstractSlider implements IRenderableControl {
 
     @Override
     protected void updateText() {
-        this.displayString = this.getDisplayValue();
+        this.setMessage(this.getDisplayValue());
     }
 
     @Override
index e76b98effc751906fb3914a2a2002c49414a41b9..1f1412f5b970df92c71639f7e19fab53ced752c5 100644 (file)
@@ -5,8 +5,8 @@ import com.irtimaled.bbor.config.Setting;
 class MaxYSettingSlider extends IntSettingSlider {
     private final int actualMinValue;
 
-    MaxYSettingSlider(int id, int x, int y, int width, int minValue, Setting<Integer> setting) {
-        super(id, x, y, width, minValue - 2, 127, "Max Y", setting);
+    MaxYSettingSlider(int x, int y, int width, int minValue, Setting<Integer> setting) {
+        super(x, y, width, minValue - 2, 127, "Max Y", setting);
         this.actualMinValue = minValue;
         this.setProgress(getSliderValue());
         this.addDisplayValue(-1, "Activated");
index 00f03124d478088b1819d5d000ed27c478e9b788..83e7f8ad958a521194aebe6bb5fc4671ea9f5477 100644 (file)
@@ -5,26 +5,27 @@ import com.irtimaled.bbor.client.renderers.Renderer;
 import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.TypeHelper;
 import com.irtimaled.bbor.config.ConfigManager;
+import com.mojang.blaze3d.platform.GLX;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.AbstractGui;
 import net.minecraft.client.gui.IGuiEventListener;
-import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.util.text.StringTextComponent;
 import org.lwjgl.opengl.GL11;
 
 import java.util.HashSet;
 import java.util.Set;
 
-public class SettingsScreen extends GuiScreen {
+public class SettingsScreen extends Screen {
     private static final int CONTROLS_WIDTH = 310;
 
-    private final GuiScreen lastScreen;
+    private final Screen lastScreen;
     private final int tabIndex;
 
-    private String title;
     private Set<IRenderableControl> controls = new HashSet<>();
 
-    SettingsScreen(GuiScreen lastScreen, int tabIndex) {
+    SettingsScreen(Screen lastScreen, int tabIndex) {
+        super(new StringTextComponent(ClientProxy.Name));
         this.lastScreen = lastScreen;
         this.tabIndex = tabIndex;
     }
@@ -49,7 +50,7 @@ public class SettingsScreen extends GuiScreen {
         for (String label : labels) {
             final int index = column;
             addControl(0, column, y, CONTROLS_WIDTH / columns,
-                    (id, x, y1, width) -> new AbstractButton(id, x, y, width, label, index != tabIndex) {
+                    (x, y1, width) -> new AbstractButton(x, y, width, label, index != tabIndex) {
                         @Override
                         public void onPressed() {
                             Minecraft.getInstance().displayGuiScreen(new SettingsScreen(lastScreen, index));
@@ -59,11 +60,11 @@ public class SettingsScreen extends GuiScreen {
         }
 
         //done button
-        addControl(new AbstractButton(200, this.width / 2 - 100, getY(5.5), 200, "Done") {
+        addControl(new AbstractButton(this.width / 2 - 100, getY(5.5), 200, "Done") {
             @Override
             public void onPressed() {
                 ConfigManager.saveConfig();
-                mc.displayGuiScreen(lastScreen);
+                minecraft.displayGuiScreen(lastScreen);
             }
         });
     }
@@ -74,8 +75,7 @@ public class SettingsScreen extends GuiScreen {
 
     private IControl addControl(int offset, int column, int y, int width, CreateControl createControl) {
         int x = getX(width, column, offset);
-        int id = controls.size();
-        IControl control = createControl.create(id, x, y, width);
+        IControl control = createControl.create(x, y, width);
         TypeHelper.doIfType(control, IRenderableControl.class, this::addControl);
         return control;
     }
@@ -109,14 +109,12 @@ public class SettingsScreen extends GuiScreen {
     }
 
     @Override
-    protected void initGui() {
-        this.title = ClientProxy.Name;
-
+    protected void init() {
         this.controls = new HashSet<>();
-        this.addTabs("General", "Structures", "Villages");
+        this.addTabs("General", "Structures");
 
         buildTab(0,
-                (id, x, y, width) -> new AbstractButton(id, x, y, width, "Active", this.mc.world != null) {
+                (x, y, width) -> new AbstractButton(x, y, width, "Active", this.minecraft.world != null) {
                     @Override
                     public void onPressed() {
                         ClientProxy.toggleActive();
@@ -124,61 +122,48 @@ public class SettingsScreen extends GuiScreen {
 
                     @Override
                     protected int getState() {
-                        return enabled ? ClientProxy.active ? 2 : 1 : 0;
+                        return active ? ClientProxy.active ? 2 : 1 : 0;
                     }
                 },
-                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Outer Box Only", ConfigManager.outerBoxesOnly),
-                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Fill", ConfigManager.fill),
+                (x, y, width) -> new BoolSettingButton(x, y, width, "Outer Box Only", ConfigManager.outerBoxesOnly),
+                (x, y, width) -> new BoolSettingButton(x, y, width, "Fill", ConfigManager.fill),
 
-                (id, x, y, width) -> (IRowHeight) () -> 0.5,
+                (x, y, width) -> (IRowHeight) () -> 0.5,
 
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Spawn Chunks", BoundingBoxType.WorldSpawn),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Lazy Chunks", BoundingBoxType.LazySpawnChunks),
-                (id, x, y, width) -> new MaxYSettingSlider(id, x, y, width, 39, ConfigManager.worldSpawnMaxY),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Spawn Chunks", BoundingBoxType.WorldSpawn),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Lazy Chunks", BoundingBoxType.LazySpawnChunks),
+                (x, y, width) -> new MaxYSettingSlider(x, y, width, 39, ConfigManager.worldSpawnMaxY),
 
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Slime Chunks", BoundingBoxType.SlimeChunks),
-                (id, x, y, width) -> new MaxYSettingSlider(id, x, y, width, 39, ConfigManager.slimeChunkMaxY),
-                (id, x, y, width) -> (IRowHeight) () -> 0,
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Slime Chunks", BoundingBoxType.SlimeChunks),
+                (x, y, width) -> new MaxYSettingSlider(x, y, width, 39, ConfigManager.slimeChunkMaxY),
+                (x, y, width) -> (IRowHeight) () -> 0,
 
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Mob Spawners", BoundingBoxType.MobSpawner),
-                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Spawn Area", ConfigManager.renderMobSpawnerSpawnArea),
-                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Activation Lines", ConfigManager.renderMobSpawnerActivationLines));
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Mob Spawners", BoundingBoxType.MobSpawner),
+                (x, y, width) -> new BoolSettingButton(x, y, width, "Spawn Area", ConfigManager.renderMobSpawnerSpawnArea),
+                (x, y, width) -> new BoolSettingButton(x, y, width, "Activation Lines", ConfigManager.renderMobSpawnerActivationLines));
         buildTab(1,
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Desert Temples", BoundingBoxType.DesertTemple),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Jungle Temples", BoundingBoxType.JungleTemple),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Witch Huts", BoundingBoxType.WitchHut),
-
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Mansions", BoundingBoxType.Mansion),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Monuments", BoundingBoxType.OceanMonument),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Igloos", BoundingBoxType.Igloo),
-
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Ocean Ruins", BoundingBoxType.OceanRuin),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Buried Treasure", BoundingBoxType.BuriedTreasure),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Shipwrecks", BoundingBoxType.Shipwreck),
-
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Pillager Outposts", BoundingBoxType.PillagerOutpost, false),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Strongholds", BoundingBoxType.Stronghold),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Mineshafts", BoundingBoxType.MineShaft),
-
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "Fortresses", BoundingBoxType.NetherFortress),
-                (id, x, y, width) -> new BoundingBoxTypeButton(id, x, y, width, "End Cities", BoundingBoxType.EndCity));
-        buildTab(2,
-                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Villages", ConfigManager.drawVillages),
-                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Door Lines", ConfigManager.drawVillageDoors),
-                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Golem Spawn", ConfigManager.drawIronGolemSpawnArea),
-
-                (id, x, y, width) -> new BoolSettingButton(id, x, y, width, "Render Sphere", ConfigManager.renderVillageAsSphere),
-                (id, x, y, width) -> new IntSettingSlider(id, x, y, width, 1, 5, "Dot Size", ConfigManager.villageSphereDotSize),
-                (id, x, y, width) -> new IntSettingSlider(id, x, y, width, 1, 5, "Density", ConfigManager.villageSphereDensity)
-                        .addDisplayValue(1, "Fewest")
-                        .addDisplayValue(2, "Fewer")
-                        .addDisplayValue(3, "Normal")
-                        .addDisplayValue(4, "More")
-                        .addDisplayValue(5, "Most"));
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Desert Temples", BoundingBoxType.DesertTemple),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Jungle Temples", BoundingBoxType.JungleTemple),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Witch Huts", BoundingBoxType.WitchHut),
+
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Mansions", BoundingBoxType.Mansion),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Monuments", BoundingBoxType.OceanMonument),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Igloos", BoundingBoxType.Igloo),
+
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Ocean Ruins", BoundingBoxType.OceanRuin),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Buried Treasure", BoundingBoxType.BuriedTreasure),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Shipwrecks", BoundingBoxType.Shipwreck),
+
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Pillager Outposts", BoundingBoxType.PillagerOutpost),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Strongholds", BoundingBoxType.Stronghold),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Mineshafts", BoundingBoxType.MineShaft),
+
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "Fortresses", BoundingBoxType.NetherFortress),
+                (x, y, width) -> new BoundingBoxTypeButton(x, y, width, "End Cities", BoundingBoxType.EndCity));
     }
 
     private void drawScreen(int top, int bottom) {
-        this.mc.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
+        this.minecraft.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION);
 
         GL11.glDisable(GL11.GL_LIGHTING);
         GL11.glDisable(GL11.GL_FOG);
@@ -195,7 +180,7 @@ public class SettingsScreen extends GuiScreen {
 
         GL11.glDisable(GL11.GL_DEPTH_TEST);
         GL11.glEnable(GL11.GL_BLEND);
-        OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
+        GLX.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
 
         GL11.glDisable(GL11.GL_ALPHA_TEST);
         GL11.glShadeModel(7425);
@@ -222,17 +207,17 @@ public class SettingsScreen extends GuiScreen {
         GL11.glEnable(GL11.GL_TEXTURE_2D);
         GL11.glShadeModel(7424);
         GL11.glEnable(GL11.GL_ALPHA_TEST);
-        OpenGlHelper.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
+        GLX.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
         GL11.glDisable(GL11.GL_BLEND);
     }
 
     @Override
     public void render(int mouseX, int mouseY, float unknown) {
-        if (this.mc.world == null) {
-            this.drawDefaultBackground();
+        if (this.minecraft.world == null) {
+            this.renderBackground();
             this.drawScreen(getY(-1), getY(5.5) - 4);
         }
-        this.drawCenteredString(this.fontRenderer, this.title, this.width / 2, 15, 16777215);
+        this.drawCenteredString(this.font, title.getUnformattedComponentText(), this.width / 2, 15, 16777215);
         for (IRenderableControl control : controls) {
             control.render(mouseX, mouseY);
         }
index d9dd00323d80dd643b85dd322b4460b7a1a8b35c..c7d1fba59744169c6f1abe1278c779c0e6caec50 100644 (file)
@@ -1,13 +1,13 @@
 package com.irtimaled.bbor.client.gui;
 
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.screen.Screen;
 
 public class SettingsScreenButton extends AbstractButton {
     private final SettingsScreen screen;
 
-    public SettingsScreenButton(int id, int x, int y, int width, String label, GuiScreen lastScreen) {
-        super(id, x, y, width, label);
+    public SettingsScreenButton(int x, int y, int width, String label, Screen lastScreen) {
+        super(x, y, width, label);
         screen = new SettingsScreen(lastScreen, 0);
     }
 
index 190ac736a063852785921f0b016f9659652e2a5b..ce7f709178954cf91c5aa8eb2cc4fd8822f77aa2 100644 (file)
@@ -6,7 +6,7 @@ import com.irtimaled.bbor.client.events.Render;
 import com.irtimaled.bbor.client.events.SeedCommandTyped;
 import com.irtimaled.bbor.client.events.UpdateWorldSpawnReceived;
 import com.irtimaled.bbor.common.EventBus;
-import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.entity.player.ClientPlayerEntity;
 import net.minecraft.util.math.BlockPos;
 
 public class ClientInterop {
@@ -14,7 +14,7 @@ public class ClientInterop {
         EventBus.publish(new DisconnectedFromRemoteServer());
     }
 
-    public static void render(float partialTicks, EntityPlayerSP player) {
+    public static void render(float partialTicks, ClientPlayerEntity player) {
         PlayerCoords.setPlayerPosition(partialTicks, player);
         EventBus.publish(new Render(player.dimension.getId()));
     }
index a680d7c74736a87c4fbd00e8e0455463a115bcb9..b6def1a51a7a54a44a152224ab49d64042d9b88d 100644 (file)
@@ -25,7 +25,7 @@ public class KeyListener {
     }
 
     private static void onKeyEvent(long windowHandle, int keyCode, int scanCode, int action, int modifiers) {
-        if (windowHandle == mainWindowHandle && minecraft.currentScreen == null && keyCode != -1 && !InputMappings.isKeyDown(292)) {
+        if (windowHandle == mainWindowHandle && minecraft.currentScreen == null && keyCode != -1 && !InputMappings.func_216506_a(mainWindowHandle, 292)) {
             InputMappings.Input input = InputMappings.getInputByCode(keyCode, scanCode);
             for (Key key : keys) {
                 if (key.getInput() == input) {
index 3689fd2c87c10b1334203435cbfb3f69dc911e7e..2c2d315927342b5c65aefa944fd8707f5ccbeebf 100644 (file)
@@ -1,6 +1,5 @@
 package com.irtimaled.bbor.client.renderers;
 
-import com.irtimaled.bbor.client.PlayerCoords;
 import com.irtimaled.bbor.common.models.BoundingBoxMobSpawner;
 import com.irtimaled.bbor.common.models.Colors;
 import com.irtimaled.bbor.common.models.Coords;
@@ -26,13 +25,13 @@ public class MobSpawnerRenderer extends AbstractRenderer<BoundingBoxMobSpawner>
     }
 
     private void renderActivationLine(OffsetPoint centerPoint) {
-        OffsetPoint playerPos = new OffsetPoint(PlayerCoords.getX(), PlayerCoords.getY(), PlayerCoords.getZ());
-        double distance = centerPoint.getDistance(playerPos);
+        OffsetPoint camera = OffsetPoint.Camera();
+        double distance = centerPoint.getDistance(camera);
         if (distance <= 20) {
             Color color = distance > 18 ? Color.RED : distance > 16 ? Colors.DARK_ORANGE : Color.GREEN;
 
             GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
-            Renderer.startLines().setColor(color).addPoint(centerPoint).addPoint(playerPos.offset(0, 0.1, 0)).render();
+            Renderer.startLines().setColor(color).addPoint(centerPoint).addPoint(camera.offset(0, -1, 0)).render();
         }
     }
 }
index 4184faeca35c7019c0fa9d042a3d62b7c1cde124..9992f4d0537fd1c98ad4ce006383d287ef62a9da 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor.client.renderers;
 
-import com.irtimaled.bbor.client.PlayerCoords;
+import com.irtimaled.bbor.client.CameraCoords;
 import com.irtimaled.bbor.common.models.Coords;
 
 class OffsetPoint {
@@ -20,16 +20,20 @@ class OffsetPoint {
         this.z = Coords.getZ();
     }
 
+    static OffsetPoint Camera() {
+        return new OffsetPoint(CameraCoords.getX(), CameraCoords.getY(), CameraCoords.getZ());
+    }
+
     double getX() {
-        return x - PlayerCoords.getX();
+        return x - CameraCoords.getX();
     }
 
     double getY() {
-        return y - PlayerCoords.getY();
+        return y - CameraCoords.getY();
     }
 
     double getZ() {
-        return z - PlayerCoords.getZ();
+        return z - CameraCoords.getZ();
     }
 
     OffsetPoint offset(double x, double y, double z) {
diff --git a/src/main/java/com/irtimaled/bbor/client/renderers/VillageRenderer.java b/src/main/java/com/irtimaled/bbor/client/renderers/VillageRenderer.java
deleted file mode 100644 (file)
index 6bcd66d..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-package com.irtimaled.bbor.client.renderers;
-
-import com.irtimaled.bbor.common.models.BoundingBoxVillage;
-import com.irtimaled.bbor.common.models.Coords;
-import com.irtimaled.bbor.config.ConfigManager;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.*;
-import java.util.HashSet;
-import java.util.Set;
-
-public class VillageRenderer extends AbstractRenderer<BoundingBoxVillage> {
-    @Override
-    public void render(BoundingBoxVillage boundingBox) {
-        if (ConfigManager.renderVillageAsSphere.get()) {
-            renderBoundingBoxVillageAsSphere(boundingBox);
-        } else {
-            renderBoundingBox(boundingBox);
-        }
-        if (ConfigManager.drawIronGolemSpawnArea.get() &&
-                boundingBox.getSpawnsIronGolems()) {
-            renderIronGolemSpawnArea(boundingBox);
-        }
-        if (ConfigManager.drawVillageDoors.get()) {
-            renderVillageDoors(boundingBox);
-        }
-    }
-
-    private void renderIronGolemSpawnArea(BoundingBoxVillage boundingBox) {
-        OffsetPoint offsetCenter = new OffsetPoint(boundingBox.getCenter())
-                .offset(boundingBox.getCenterOffsetX(), 0.0, boundingBox.getCenterOffsetZ());
-        OffsetBox bb = new OffsetBox(offsetCenter, offsetCenter)
-                .grow(8, 3, 8);
-
-        renderUnfilledCuboid(bb, boundingBox.getColor());
-    }
-
-    private void renderVillageDoors(BoundingBoxVillage boundingBox) {
-        OffsetPoint center = new OffsetPoint(boundingBox.getCenter())
-                .offset(boundingBox.getCenterOffsetX(), 0.0, boundingBox.getCenterOffsetZ());
-        Color color = boundingBox.getColor();
-
-        GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
-        Renderer renderer = Renderer.startLines()
-                .setColor(color);
-        for (Coords door : boundingBox.getDoors()) {
-            OffsetPoint point = new OffsetPoint(door).offset(0.5, 0, 0.5);
-
-            renderer.addPoint(point)
-                    .addPoint(center);
-        }
-        renderer.render();
-    }
-
-    private void renderBoundingBoxVillageAsSphere(BoundingBoxVillage boundingBox) {
-        OffsetPoint center = new OffsetPoint(boundingBox.getCenter())
-                .offset(boundingBox.getCenterOffsetX(), 0.0, boundingBox.getCenterOffsetZ());
-        int radius = boundingBox.getRadius();
-        Color color = boundingBox.getColor();
-        int density = ConfigManager.villageSphereDensity.get();
-        int dotSize = ConfigManager.villageSphereDotSize.get();
-
-        GL11.glEnable(GL11.GL_POINT_SMOOTH);
-        GL11.glPointSize(dotSize);
-        Renderer renderer = Renderer.startPoints()
-                .setColor(color);
-        buildPoints(center, (double) radius, density)
-                .forEach(renderer::addPoint);
-        renderer.render();
-    }
-
-    private Set<OffsetPoint> buildPoints(OffsetPoint center, double radius, int density) {
-        int segments = 24 + (density * 8);
-
-        Set<OffsetPoint> points = new HashSet<>(segments * segments);
-        double tau = 6.283185307179586D;
-        double pi = tau / 2D;
-
-        double thetaSegment = pi / (double) segments;
-        double phiSegment = tau / (double) segments;
-
-        for (double phi = 0.0D; phi < tau; phi += phiSegment) {
-            for (double theta = 0.0D; theta < pi; theta += thetaSegment) {
-                double dx = radius * Math.sin(phi) * Math.cos(theta);
-                double dz = radius * Math.sin(phi) * Math.sin(theta);
-                double dy = radius * Math.cos(phi);
-
-                points.add(center.offset(dx, dy, dz));
-            }
-        }
-        return points;
-    }
-}
index 51d95bfabff922aa610628246d428017e357029c..201bf9bad4082cdb2adea31e13910eec0c04d464 100644 (file)
@@ -30,7 +30,6 @@ public class BoundingBoxType {
     public final static BoundingBoxType LazySpawnChunks = register(Color.RED, "Lazy_Chunks", ConfigManager.drawLazySpawnChunks);
     public final static BoundingBoxType MobSpawner = register(Color.GREEN, "Mob_Spawner", ConfigManager.drawMobSpawners);
     public final static BoundingBoxType SlimeChunks = register(Colors.DARK_GREEN, "Slime_Chunks", ConfigManager.drawSlimeChunks);
-    public final static BoundingBoxType Village = register(null, "Village", ConfigManager.drawVillages);
 
     private static BoundingBoxType register(Color color, String name, Setting<Boolean> shouldRenderSetting) {
         return structureTypeMap.computeIfAbsent(name.hashCode(), k -> new BoundingBoxType(color, name, shouldRenderSetting));
index c447f11b95fb10774d2ca6ce32faa5428d3b126f..e95d9ebbdc7e4130799435a1c47ed4d57bf7f4e1 100644 (file)
@@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
 public class CommonProxy {
     private Map<Integer, ServerPlayer> players = new ConcurrentHashMap<>();
     private Map<Integer, Set<AbstractBoundingBox>> playerBoundingBoxesCache = new HashMap<>();
-    private Map<Integer, VillageProcessor> villageProcessors = new HashMap<>();
     private Map<Integer, AbstractChunkProcessor> chunkProcessors = new HashMap<>();
     private final Map<Integer, BoundingBoxCache> dimensionCache = new ConcurrentHashMap<>();
     private Long seed = null;
@@ -37,9 +36,7 @@ public class CommonProxy {
         EventBus.subscribe(PlayerLoggedIn.class, this::playerLoggedIn);
         EventBus.subscribe(PlayerLoggedOut.class, this::playerLoggedOut);
         EventBus.subscribe(PlayerSubscribed.class, this::onPlayerSubscribed);
-        EventBus.subscribe(ServerWorldTick.class, this::serverWorldTick);
         EventBus.subscribe(ServerTick.class, e -> serverTick());
-        EventBus.subscribe(VillageRemoved.class, this::onVillageRemoved);
     }
 
     protected void setSeed(long seed) {
@@ -71,7 +68,6 @@ public class CommonProxy {
         }
         Logger.info("create world dimension: %s (seed: %d)", dimensionId, seed);
         chunkProcessors.put(dimensionId, chunkProcessor);
-        villageProcessors.put(dimensionId, new VillageProcessor(dimensionId, boundingBoxCache));
     }
 
     private void chunkLoaded(ChunkLoaded event) {
@@ -95,10 +91,6 @@ public class CommonProxy {
         playerBoundingBoxesCache.remove(playerId);
     }
 
-    private void onVillageRemoved(VillageRemoved event) {
-        sendRemoveBoundingBox(event.getDimensionId(), event.getVillage());
-    }
-
     private void sendRemoveBoundingBox(int dimensionId, AbstractBoundingBox boundingBox) {
         PayloadBuilder payload = RemoveBoundingBox.getPayload(dimensionId, boundingBox);
         if (payload == null) return;
@@ -170,13 +162,6 @@ public class CommonProxy {
         }
     }
 
-    private void serverWorldTick(ServerWorldTick event) {
-        VillageProcessor villageProcessor = villageProcessors.get(event.getDimensionId());
-        if (villageProcessor == null) return;
-
-        villageProcessor.process(event.getWorld());
-    }
-
     protected BoundingBoxCache getCache(int dimensionId) {
         return dimensionCache.get(dimensionId);
     }
@@ -186,10 +171,6 @@ public class CommonProxy {
     }
 
     protected void clearCaches() {
-        for (VillageProcessor villageProcessor : villageProcessors.values()) {
-            villageProcessor.clear();
-        }
-        villageProcessors.clear();
         for (BoundingBoxCache cache : dimensionCache.values()) {
             cache.clear();
         }
diff --git a/src/main/java/com/irtimaled/bbor/common/VillageColorCache.java b/src/main/java/com/irtimaled/bbor/common/VillageColorCache.java
deleted file mode 100644 (file)
index d5071a7..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.irtimaled.bbor.common;
-
-import java.awt.*;
-import java.util.HashMap;
-import java.util.Map;
-
-public class VillageColorCache {
-    private static int colorIndex = -1;
-
-    public static void clear() {
-        colorIndex = -1;
-        villageColorCache.clear();
-    }
-
-    private static Color getNextColor() {
-        switch (++colorIndex % 6) {
-            case 0:
-                return Color.RED;
-            case 1:
-                return Color.GREEN;
-            case 2:
-                return Color.BLUE;
-            case 3:
-                return Color.MAGENTA;
-            case 4:
-                return Color.YELLOW;
-            case 5:
-                return Color.CYAN;
-        }
-        return Color.WHITE;
-    }
-
-    private static Map<Integer, Color> villageColorCache = new HashMap<>();
-
-    public static Color getColor(int villageId) {
-        return villageColorCache.computeIfAbsent(villageId, k -> getNextColor());
-    }
-}
diff --git a/src/main/java/com/irtimaled/bbor/common/VillageHelper.java b/src/main/java/com/irtimaled/bbor/common/VillageHelper.java
deleted file mode 100644 (file)
index 0dff471..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.irtimaled.bbor.common;
-
-import com.irtimaled.bbor.common.models.Coords;
-
-import java.util.Set;
-
-public class VillageHelper {
-    public static boolean shouldSpawnIronGolems(int population, int doorCount) {
-        return population >= 10 && doorCount >= 21;
-    }
-
-    public static int computeHash(Coords center, Integer radius, boolean spawnsIronGolems, Set<Coords> doors) {
-        int result = (center.hashCode() * 31) + radius;
-        for (Coords door : doors) {
-            result = (31 * result) + door.hashCode();
-        }
-        if (spawnsIronGolems) {
-            result = 31 * result;
-        }
-        return result;
-    }
-}
diff --git a/src/main/java/com/irtimaled/bbor/common/VillageProcessor.java b/src/main/java/com/irtimaled/bbor/common/VillageProcessor.java
deleted file mode 100644 (file)
index 2e954ca..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.irtimaled.bbor.common;
-
-import com.irtimaled.bbor.common.events.VillageRemoved;
-import com.irtimaled.bbor.common.models.BoundingBoxVillage;
-import com.irtimaled.bbor.common.models.Coords;
-import net.minecraft.village.Village;
-import net.minecraft.village.VillageCollection;
-import net.minecraft.village.VillageDoorInfo;
-import net.minecraft.world.WorldServer;
-
-import java.util.*;
-
-class VillageProcessor {
-    private final BoundingBoxCache boundingBoxCache;
-
-    private Map<Integer, BoundingBoxVillage> villageCache = new HashMap<>();
-    private int dimensionId;
-
-    VillageProcessor(int dimensionId, BoundingBoxCache boundingBoxCache) {
-        this.dimensionId = dimensionId;
-        this.boundingBoxCache = boundingBoxCache;
-    }
-
-    void process(WorldServer world) {
-        Map<Integer, BoundingBoxVillage> oldVillages = new HashMap<>(villageCache);
-        Map<Integer, BoundingBoxVillage> newVillages = new HashMap<>();
-        VillageCollection villageCollection = world.getVillageCollection();
-        for (Village village : villageCollection.getVillageList()) {
-            int villageId = village.hashCode();
-            BoundingBoxVillage newVillage = oldVillages.get(villageId);
-            if (areEquivalent(village, newVillage)) {
-                oldVillages.remove(villageId);
-            } else {
-                newVillage = buildBoundingBox(village);
-                boundingBoxCache.addBoundingBox(newVillage);
-            }
-            newVillages.put(villageId, newVillage);
-        }
-        for (BoundingBoxVillage village : oldVillages.values()) {
-            boundingBoxCache.removeBoundingBox(village);
-            EventBus.publish(new VillageRemoved(dimensionId, village));
-        }
-        villageCache = newVillages;
-    }
-
-    private static Set<Coords> getDoorsFromVillage(Village village) {
-        Set<Coords> doors = new HashSet<>();
-        List<VillageDoorInfo> doorInfoList = village.getVillageDoorInfoList();
-        for (VillageDoorInfo doorInfo : doorInfoList) {
-            doors.add(new Coords(doorInfo.getDoorBlockPos()));
-        }
-        return doors;
-    }
-
-    private boolean areEquivalent(Village village, BoundingBoxVillage newVillage) {
-        if (newVillage == null) return false;
-        Coords center = new Coords(village.getCenter());
-        int radius = village.getVillageRadius();
-        boolean spawnsIronGolems = VillageHelper.shouldSpawnIronGolems(village.getNumVillagers(), village.getNumVillageDoors());
-        Set<Coords> doors = getDoorsFromVillage(village);
-        int villageHash = VillageHelper.computeHash(center, radius, spawnsIronGolems, doors);
-        return newVillage.getVillageHash() == villageHash;
-    }
-
-    private BoundingBoxVillage buildBoundingBox(Village village) {
-        Coords center = new Coords(village.getCenter());
-        int radius = village.getVillageRadius();
-        Set<Coords> doors = getDoorsFromVillage(village);
-        return BoundingBoxVillage.from(center, radius, village.hashCode(), village.getNumVillagers(), doors);
-    }
-
-    void clear() {
-        villageCache.clear();
-    }
-}
index efb75941bb6c002b787bf0be21749f07e4909f89..00ff3fa9e13d22fd666a283d0337479ea69c2907 100644 (file)
@@ -7,8 +7,8 @@ import com.irtimaled.bbor.common.models.AbstractBoundingBox;
 import com.irtimaled.bbor.common.models.BoundingBoxMobSpawner;
 import com.irtimaled.bbor.common.models.BoundingBoxStructure;
 import com.irtimaled.bbor.common.models.Coords;
+import net.minecraft.tileentity.MobSpawnerTileEntity;
 import net.minecraft.tileentity.TileEntity;
-import net.minecraft.tileentity.TileEntityMobSpawner;
 import net.minecraft.util.math.MutableBoundingBox;
 import net.minecraft.world.chunk.Chunk;
 import net.minecraft.world.gen.feature.structure.StructurePiece;
@@ -54,7 +54,7 @@ public abstract class AbstractChunkProcessor {
     private void addMobSpawners(Chunk chunk) {
         Collection<TileEntity> tileEntities = chunk.getTileEntityMap().values();
         for (TileEntity tileEntity : tileEntities) {
-            TileEntityMobSpawner spawner = TypeHelper.as(tileEntity, TileEntityMobSpawner.class);
+            MobSpawnerTileEntity spawner = TypeHelper.as(tileEntity, MobSpawnerTileEntity.class);
             if (spawner != null) {
                 Coords coords = new Coords(spawner.getPos());
                 boundingBoxCache.addBoundingBox(BoundingBoxMobSpawner.from(coords));
diff --git a/src/main/java/com/irtimaled/bbor/common/events/ServerWorldTick.java b/src/main/java/com/irtimaled/bbor/common/events/ServerWorldTick.java
deleted file mode 100644 (file)
index 8b20b87..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.irtimaled.bbor.common.events;
-
-import net.minecraft.world.WorldServer;
-
-public class ServerWorldTick {
-    private final int dimensionId;
-    private WorldServer world;
-
-    public ServerWorldTick(WorldServer world) {
-        this.world = world;
-        this.dimensionId = world.getDimension().getType().getId();
-    }
-
-    public WorldServer getWorld() {
-        return world;
-    }
-
-    public int getDimensionId() {
-        return dimensionId;
-    }
-}
diff --git a/src/main/java/com/irtimaled/bbor/common/events/VillageRemoved.java b/src/main/java/com/irtimaled/bbor/common/events/VillageRemoved.java
deleted file mode 100644 (file)
index 979eaed..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.irtimaled.bbor.common.events;
-
-import com.irtimaled.bbor.common.models.BoundingBoxVillage;
-
-public class VillageRemoved {
-    private final int dimensionId;
-    private final BoundingBoxVillage village;
-
-    public VillageRemoved(int dimensionId, BoundingBoxVillage village) {
-        this.dimensionId = dimensionId;
-        this.village = village;
-    }
-
-    public int getDimensionId() {
-        return dimensionId;
-    }
-
-    public BoundingBoxVillage getVillage() {
-        return village;
-    }
-}
index 12596b341a94d0a169eefd2c3dd83fd050bce7f7..33f44e98fb493dcb5b495befc6f8687b3bdde670 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor.common.events;
 
-import net.minecraft.world.WorldServer;
+import net.minecraft.world.ServerWorld;
 import net.minecraft.world.storage.WorldInfo;
 
 public class WorldLoaded {
@@ -9,7 +9,7 @@ public class WorldLoaded {
     private final int spawnX;
     private final int spawnZ;
 
-    public WorldLoaded(WorldServer world) {
+    public WorldLoaded(ServerWorld world) {
         WorldInfo info = world.getWorldInfo();
         this.dimensionId = world.getDimension().getType().getId();
         this.seed = info.getSeed();
index f0a82190bb6692d103112c5c5cf6fde7eca6e439..ea043bec346a9103328b5c189a820594d7f009bc 100644 (file)
@@ -6,13 +6,13 @@ 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.block.SpawnerBlock;
+import net.minecraft.entity.player.ServerPlayerEntity;
 import net.minecraft.network.NetworkManager;
+import net.minecraft.network.play.ServerPlayNetHandler;
 import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.ServerWorld;
 import net.minecraft.world.World;
-import net.minecraft.world.WorldServer;
 import net.minecraft.world.chunk.Chunk;
 
 import java.io.File;
@@ -27,13 +27,13 @@ public class CommonInterop {
         EventBus.publish(new ChunkLoaded(chunk));
     }
 
-    public static void loadWorlds(Collection<WorldServer> worlds) {
-        for (WorldServer world : worlds) {
+    public static void loadWorlds(Collection<ServerWorld> worlds) {
+        for (ServerWorld world : worlds) {
             loadWorld(world);
         }
     }
 
-    public static void loadWorld(WorldServer world) {
+    public static void loadWorld(ServerWorld world) {
         EventBus.publish(new WorldLoaded(world));
     }
 
@@ -41,12 +41,8 @@ public class CommonInterop {
         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;
+    public static void playerLoggedIn(ServerPlayerEntity player) {
+        ServerPlayNetHandler connection = player.connection;
         if (connection == null) return;
 
         NetworkManager networkManager = connection.netManager;
@@ -55,16 +51,16 @@ public class CommonInterop {
         EventBus.publish(new PlayerLoggedIn(new ServerPlayer(player)));
     }
 
-    public static void playerLoggedOut(EntityPlayerMP player) {
+    public static void playerLoggedOut(ServerPlayerEntity player) {
         EventBus.publish(new PlayerLoggedOut(player.getEntityId()));
     }
 
-    public static void playerSubscribed(EntityPlayerMP player) {
+    public static void playerSubscribed(ServerPlayerEntity player) {
         EventBus.publish(new PlayerSubscribed(player.getEntityId(), new ServerPlayer(player)));
     }
 
     public static void tryHarvestBlock(Block block, BlockPos pos, World world) {
-        if (block instanceof BlockMobSpawner) {
+        if (block instanceof SpawnerBlock) {
             EventBus.publish(new MobSpawnerBroken(world.dimension.getType().getId(), new Coords(pos)));
         }
     }
index 9481c88a7e50061502ccda09cbebb773073cc37a..a4c65bcecaf504adb172c0055a4c19c2deaad89a 100644 (file)
@@ -1,11 +1,10 @@
 package com.irtimaled.bbor.common.messages;
 
 import com.irtimaled.bbor.common.BoundingBoxType;
-import com.irtimaled.bbor.common.models.*;
-
-import java.awt.*;
-import java.util.HashSet;
-import java.util.Set;
+import com.irtimaled.bbor.common.models.AbstractBoundingBox;
+import com.irtimaled.bbor.common.models.BoundingBoxMobSpawner;
+import com.irtimaled.bbor.common.models.BoundingBoxStructure;
+import com.irtimaled.bbor.common.models.Coords;
 
 class BoundingBoxDeserializer {
     static AbstractBoundingBox deserialize(PayloadReader reader) {
@@ -13,8 +12,6 @@ class BoundingBoxDeserializer {
 
         char type = reader.readChar();
         switch (type) {
-            case 'V':
-                return deserializeVillage(reader);
             case 'S':
                 return deserializeStructure(reader);
             case 'M':
@@ -31,18 +28,6 @@ class BoundingBoxDeserializer {
         return BoundingBoxStructure.from(minCoords, maxCoords, type);
     }
 
-    private static AbstractBoundingBox deserializeVillage(PayloadReader reader) {
-        Coords center = reader.readCoords();
-        int radius = reader.readVarInt();
-        boolean spawnsIronGolems = reader.readBoolean();
-        Color color = new Color(reader.readVarInt());
-        Set<Coords> doors = new HashSet<>();
-        while (reader.isReadable()) {
-            doors.add(reader.readCoords());
-        }
-        return BoundingBoxVillage.from(center, radius, color, spawnsIronGolems, doors);
-    }
-
     private static AbstractBoundingBox deserializeMobSpawner(PayloadReader reader) {
         return BoundingBoxMobSpawner.from(reader.readCoords());
     }
index 40d9084054e011775a1e4931eec370977a021dba..dd3620d4cabbb52286269c431e74447921d19905 100644 (file)
@@ -1,6 +1,8 @@
 package com.irtimaled.bbor.common.messages;
 
-import com.irtimaled.bbor.common.models.*;
+import com.irtimaled.bbor.common.models.AbstractBoundingBox;
+import com.irtimaled.bbor.common.models.BoundingBoxMobSpawner;
+import com.irtimaled.bbor.common.models.BoundingBoxStructure;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -10,7 +12,6 @@ class BoundingBoxSerializer {
     private static final Map<Class, BiConsumer<AbstractBoundingBox, PayloadBuilder>> serializers = new HashMap<>();
 
     static {
-        serializers.put(BoundingBoxVillage.class, (bb, pb) -> serializeVillage((BoundingBoxVillage) bb, pb));
         serializers.put(BoundingBoxStructure.class, (bb, pb) -> serializeStructure((BoundingBoxStructure) bb, pb));
         serializers.put(BoundingBoxMobSpawner.class, (bb, pb) -> serializeMobSpawner((BoundingBoxMobSpawner) bb, pb));
     }
@@ -26,17 +27,6 @@ class BoundingBoxSerializer {
         serializer.accept(boundingBox, builder);
     }
 
-    private static void serializeVillage(BoundingBoxVillage boundingBox, PayloadBuilder builder) {
-        builder.writeChar('V')
-                .writeCoords(boundingBox.getCenter())
-                .writeVarInt(boundingBox.getRadius())
-                .writeBoolean(boundingBox.getSpawnsIronGolems())
-                .writeVarInt(boundingBox.getColor().getRGB());
-        for (Coords door : boundingBox.getDoors()) {
-            builder.writeCoords(door);
-        }
-    }
-
     private static void serializeStructure(BoundingBoxStructure boundingBox, PayloadBuilder builder) {
         builder.writeChar('S')
                 .writeInt(boundingBox.getTypeName().hashCode())
index ec2579a3a576a4e1a48b2b80c3a06188111a5c2a..47a2a9ed1c657c68dbe375d7b0f388528178d3d8 100644 (file)
@@ -2,10 +2,10 @@ package com.irtimaled.bbor.common.messages;
 
 import com.irtimaled.bbor.common.models.Coords;
 import io.netty.buffer.Unpooled;
-import net.minecraft.network.Packet;
+import net.minecraft.network.IPacket;
 import net.minecraft.network.PacketBuffer;
-import net.minecraft.network.play.client.CPacketCustomPayload;
-import net.minecraft.network.play.server.SPacketCustomPayload;
+import net.minecraft.network.play.client.CCustomPayloadPacket;
+import net.minecraft.network.play.server.SCustomPayloadPlayPacket;
 import net.minecraft.util.ResourceLocation;
 
 import java.util.HashMap;
@@ -16,26 +16,26 @@ public class PayloadBuilder {
     private static Map<String, ResourceLocation> packetNames = new HashMap<>();
 
     static PayloadBuilder clientBound(String name) {
-        return new PayloadBuilder(packetNames.computeIfAbsent(name, ResourceLocation::new), SPacketCustomPayload::new);
+        return new PayloadBuilder(packetNames.computeIfAbsent(name, ResourceLocation::new), SCustomPayloadPlayPacket::new);
     }
 
     static PayloadBuilder serverBound(String name) {
-        return new PayloadBuilder(packetNames.computeIfAbsent(name, ResourceLocation::new), CPacketCustomPayload::new);
+        return new PayloadBuilder(packetNames.computeIfAbsent(name, ResourceLocation::new), CCustomPayloadPacket::new);
     }
 
     private final ResourceLocation name;
-    private final BiFunction<ResourceLocation, PacketBuffer, Packet<?>> packetBuilder;
+    private final BiFunction<ResourceLocation, PacketBuffer, IPacket<?>> packetBuilder;
     private final PacketBuffer buffer;
 
-    private PayloadBuilder(ResourceLocation name, BiFunction<ResourceLocation, PacketBuffer, Packet<?>> packetBuilder) {
+    private PayloadBuilder(ResourceLocation name, BiFunction<ResourceLocation, PacketBuffer, IPacket<?>> packetBuilder) {
         this.name = name;
         this.buffer = new PacketBuffer(Unpooled.buffer());
         this.packetBuilder = packetBuilder;
     }
 
-    private Packet<?> packet;
+    private IPacket<?> packet;
 
-    public Packet<?> build() {
+    public IPacket<?> build() {
         if (packet == null)
             packet = packetBuilder.apply(name, buffer);
         return packet;
diff --git a/src/main/java/com/irtimaled/bbor/common/models/BoundingBoxVillage.java b/src/main/java/com/irtimaled/bbor/common/models/BoundingBoxVillage.java
deleted file mode 100644 (file)
index e3e82d1..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-package com.irtimaled.bbor.common.models;
-
-import com.irtimaled.bbor.common.BoundingBoxType;
-import com.irtimaled.bbor.common.VillageColorCache;
-import com.irtimaled.bbor.common.VillageHelper;
-
-import java.awt.*;
-import java.util.Set;
-
-public class BoundingBoxVillage extends AbstractBoundingBox {
-    private final Coords center;
-    private final Integer radius;
-    private final boolean spawnsIronGolems;
-    private final Color color;
-    private Set<Coords> doors;
-    private Double centerOffsetX;
-    private Double centerOffsetZ;
-    private int villageHash;
-
-    private BoundingBoxVillage(Coords center, Integer radius, Color color, boolean spawnsIronGolems, Set<Coords> doors, Coords minCoords, Coords maxCoords) {
-        super(minCoords, maxCoords, BoundingBoxType.Village);
-        this.center = center;
-        this.radius = radius;
-        this.color = color;
-        this.spawnsIronGolems = spawnsIronGolems;
-        this.doors = doors;
-        this.villageHash = VillageHelper.computeHash(center, radius, spawnsIronGolems, doors);
-        calculateCenterOffsets(doors);
-    }
-
-    public static BoundingBoxVillage from(Coords center, Integer radius, Color color, boolean spawnsIronGolems, Set<Coords> doors) {
-        Coords minCoords = new Coords(center.getX() - radius,
-                center.getY() - 4,
-                center.getZ() - radius);
-        Coords maxCoords = new Coords(center.getX() + radius,
-                center.getY() + 4,
-                center.getZ() + radius);
-        return new BoundingBoxVillage(center, radius, color, spawnsIronGolems, doors, minCoords, maxCoords);
-    }
-
-    public static BoundingBoxVillage from(Coords center, Integer radius, int villageId, int population, Set<Coords> doors) {
-        boolean spawnsIronGolems = VillageHelper.shouldSpawnIronGolems(population, doors.size());
-        Color color = VillageColorCache.getColor(villageId);
-        return from(center, radius, color, spawnsIronGolems, doors);
-    }
-
-    private void calculateCenterOffsets(Set<Coords> doors) {
-        boolean processedFirstDoor = false;
-        int minX = 0;
-        int maxX = 0;
-        int minZ = 0;
-        int maxZ = 0;
-        for (Coords door : doors) {
-            if (!processedFirstDoor ||
-                    (minX > door.getX()))
-                minX = door.getX();
-            if (!processedFirstDoor ||
-                    maxX < door.getX())
-                maxX = door.getX();
-            if (!processedFirstDoor ||
-                    minZ > door.getZ())
-                minZ = door.getZ();
-            if (!processedFirstDoor ||
-                    maxZ < door.getZ())
-                maxZ = door.getZ();
-
-            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);
-    }
-
-    @Override
-    public String toString() {
-        return "(" + center.toString() + "; " + radius.toString() + ")";
-    }
-
-    public Integer getRadius() {
-        return radius;
-    }
-
-    public Coords getCenter() {
-        return center;
-    }
-
-    public Color getColor() {
-        return color;
-    }
-
-    public Double getCenterOffsetX() {
-        return centerOffsetX;
-    }
-
-    public Double getCenterOffsetZ() {
-        return centerOffsetZ;
-    }
-
-    @Override
-    public int hashCode() {
-        return (super.hashCode() * 31) + villageHash;
-    }
-
-    public boolean getSpawnsIronGolems() {
-        return spawnsIronGolems;
-    }
-
-    public Set<Coords> getDoors() {
-        return doors;
-    }
-
-    public int getVillageHash() {
-        return villageHash;
-    }
-}
index 1496b16a1dc9c628809f1264d1236c676cea663c..241c7d77f91db63050dfeadae4dc4dfe286f1ca8 100644 (file)
@@ -1,16 +1,16 @@
 package com.irtimaled.bbor.common.models;
 
 import com.irtimaled.bbor.common.messages.PayloadBuilder;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.network.Packet;
+import net.minecraft.entity.player.ServerPlayerEntity;
+import net.minecraft.network.IPacket;
 
 import java.util.function.Consumer;
 
 public class ServerPlayer {
     private final int dimensionId;
-    private final Consumer<Packet<?>> packetConsumer;
+    private final Consumer<IPacket<?>> packetConsumer;
 
-    public ServerPlayer(EntityPlayerMP player) {
+    public ServerPlayer(ServerPlayerEntity player) {
         this.dimensionId = player.dimension.getId();
         this.packetConsumer = player.connection::sendPacket;
     }
index 08375be9c271930ad28ad721e140287fc6743810..f1233bdd88a46a51dc3d82505bd5fbffc7568eeb 100644 (file)
@@ -9,7 +9,6 @@ public class ConfigManager {
     public static File configDir;
 
     public static Setting<Boolean> fill;
-    public static Setting<Boolean> drawVillages;
     public static Setting<Boolean> drawDesertTemples;
     public static Setting<Boolean> drawJungleTemples;
     public static Setting<Boolean> drawWitchHuts;
@@ -18,9 +17,6 @@ public class ConfigManager {
     public static Setting<Boolean> drawNetherFortresses;
     public static Setting<Boolean> drawOceanMonuments;
     public static Setting<Boolean> alwaysVisible;
-    public static Setting<Boolean> renderVillageAsSphere;
-    public static Setting<Boolean> drawIronGolemSpawnArea;
-    public static Setting<Boolean> drawVillageDoors;
     public static Setting<Boolean> drawSlimeChunks;
     public static Setting<Integer> slimeChunkMaxY;
     public static Setting<Boolean> keepCacheBetweenSessions;
@@ -38,8 +34,6 @@ public class ConfigManager {
     public static Setting<Boolean> renderMobSpawnerActivationLines;
     public static Setting<Boolean> drawPillagerOutposts;
     public static Setting<Boolean> outerBoxesOnly;
-    public static Setting<Integer> villageSphereDotSize;
-    public static Setting<Integer> villageSphereDensity;
 
     public static void loadConfig(File mcConfigDir) {
         configDir = new File(mcConfigDir, "config");
@@ -51,13 +45,6 @@ public class ConfigManager {
         alwaysVisible = setup(config, "general", "alwaysVisible", false, "If set to true boxes will be visible even through other blocks.");
         keepCacheBetweenSessions = setup(config, "general", "keepCacheBetweenSessions", false, "If set to true bounding box caches will be kept between sessions.");
 
-        drawVillages = setup(config, "villages", "drawVillages", true, "If set to true village bounding boxes are drawn.");
-        renderVillageAsSphere = setup(config, "villages", "renderVillageAsSphere", true, "If set to true villages will be drawn as a sphere. (default:true)");
-        drawIronGolemSpawnArea = setup(config, "villages", "drawIronGolemSpawnArea", true, "If set to true the iron golem spawn area of the village will be drawn. (default:true)");
-        drawVillageDoors = setup(config, "villages", "drawVillageDoors", false, "If set to true lines between the village centre and doors will be drawn. (default:false)");
-        villageSphereDotSize = setup(config, "villages", "villageSphereDotSize", 2, "The size of the dots used when rendering village as sphere.");
-        villageSphereDensity = setup(config, "villages", "villageSphereDensity", 3, "The density of the dots used when rendering village as sphere.");
-
         drawDesertTemples = setup(config, "structures", "drawDesertTemples", true, "If set to true desert temple bounding boxes are drawn.");
         drawJungleTemples = setup(config, "structures", "drawJungleTemples", true, "If set to true jungle temple bounding boxes are drawn.");
         drawWitchHuts = setup(config, "structures", "drawWitchHuts", true, "If set to true witch hut bounding boxes are drawn.");
index 2da11f3850dc115f1b78c18775514c164cd46c0f..72c642ca4771edf5d993f88d3d64e1e22b875e97 100644 (file)
@@ -7,6 +7,7 @@ public class ClientTweaker extends Tweaker {
     @Override
     protected void addOptions(List<String> args, File gameDir, File assetsDir, String profile) {
         addArg("--assetsDir", assetsDir.getPath());
+        addArg("--version", profile);
     }
 
     @Override
index 4659d9e7c7aa0fb2aac7dcf9b52528013258723d..41ea6a58884d6bedad28b8888896d05ae2ed2faf 100644 (file)
@@ -16,7 +16,6 @@ public abstract class Tweaker implements ITweaker {
     @Override
     public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
         this.args = new ArrayList<>(args);
-        addArg("--version", profile);
         addOptions(args, gameDir, assetsDir, profile);
     }
 
index 3bde9db961e68b065e12616b61b22d9a43c8ed3b..948f1c451d56e4203785ddbf874c003dbba22125 100644 (file)
@@ -2,8 +2,8 @@ package com.irtimaled.bbor.mixin.client;
 
 import com.irtimaled.bbor.client.ClientProxy;
 import com.irtimaled.bbor.common.interop.CommonInterop;
+import net.minecraft.client.GameConfiguration;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.main.GameConfiguration;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
index 5a6237bdab301ff1220f3bab48953bfc2d23f5e5..eb155b76dbc6967625cd95c337e5dbfe22d96ebe 100644 (file)
@@ -1,13 +1,13 @@
 package com.irtimaled.bbor.mixin.client.entity;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.entity.EntityPlayerSP;
+import net.minecraft.client.entity.player.ClientPlayerEntity;
 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.CallbackInfo;
 
-@Mixin(EntityPlayerSP.class)
+@Mixin(ClientPlayerEntity.class)
 public abstract class MixinEntityPlayerSP {
     @Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true)
     private void sendChatMessage(String message, CallbackInfo ci) {
index cba5640805793e985adeb12ad300236f977e1f3a..121b5540c57903ce148b579484c542c59f3a80d2 100644 (file)
@@ -1,25 +1,30 @@
 package com.irtimaled.bbor.mixin.client.gui;
 
 import com.irtimaled.bbor.client.gui.SettingsScreenButton;
-import net.minecraft.client.gui.GuiButton;
-import net.minecraft.client.gui.GuiOptions;
-import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.screen.OptionsScreen;
+import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.gui.widget.Widget;
 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.CallbackInfo;
 
-@Mixin(GuiOptions.class)
-public class MixinGuiOptions extends GuiScreen {
-    @Inject(method = "initGui", at = @At("RETURN"))
+@Mixin(OptionsScreen.class)
+public class MixinGuiOptions extends Screen {
+    private MixinGuiOptions() {
+        super(null);
+    }
+
+    @Inject(method = "init", at = @At("RETURN"))
     private void initGui(CallbackInfo ci) {
         //shuffle middle buttons up by 12 px to make space
         int top = this.height / 6 + 42;
         int bottom = this.height / 6 + 168;
-        for (GuiButton button : buttons) {
+
+        for (Widget button : buttons) {
             if (button.y >= top && button.y < bottom)
                 button.y -= 12;
         }
-        this.addButton(new SettingsScreenButton(199, this.width / 2 - 155, top + 84, 150, "BBOR", this));
+        this.addButton(new SettingsScreenButton(this.width / 2 - 155, top + 84, 150, "BBOR", this));
     }
 }
index d6f77fcbdbecfd9dd4ea3b59d865f0a4cf344ac6..7796ba73f41f58ee8e6e04fc18b3a6ca9d1db4e9 100644 (file)
@@ -1,13 +1,13 @@
 package com.irtimaled.bbor.mixin.client.multiplayer;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.multiplayer.WorldClient;
+import net.minecraft.client.world.ClientWorld;
 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.CallbackInfo;
 
-@Mixin(WorldClient.class)
+@Mixin(ClientWorld.class)
 public class MixinWorldClient {
     @Inject(method = "sendQuittingDisconnectingPacket", at = @At("RETURN"))
     private void sendQuittingDisconnectingPacket(CallbackInfo ci) {
index aa21b8328609a8d105339c44aa830517e2af0410..e85bde1ff391f7200b6d09a955b7e4ac803a6fe0 100644 (file)
@@ -1,13 +1,13 @@
 package com.irtimaled.bbor.mixin.client.network;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.network.NetHandlerLoginClient;
+import net.minecraft.client.network.login.ClientLoginNetHandler;
 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.CallbackInfo;
 
-@Mixin(NetHandlerLoginClient.class)
+@Mixin(ClientLoginNetHandler.class)
 public abstract class MixinNetHandlerLoginClient {
     @Inject(method = "onDisconnect", at = @At("HEAD"))
     private void onDisconnect(CallbackInfo ci) {
index 6f8e1a08be88d3cc753a95c7dffac823f64d5139..4a4fedd289ba5550adb78fbcc332bc24df7ae745 100644 (file)
@@ -1,13 +1,13 @@
 package com.irtimaled.bbor.mixin.client.network;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.network.NetHandlerPlayClient;
+import net.minecraft.client.network.play.ClientPlayNetHandler;
 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.CallbackInfo;
 
-@Mixin(NetHandlerPlayClient.class)
+@Mixin(ClientPlayNetHandler.class)
 public class MixinNetHandlerPlayClient {
     @Inject(method = "onDisconnect", at = @At("HEAD"))
     private void onDisconnect(CallbackInfo ci) {
index ac93d6659fb271832021df39c8321fdb9d4da515..9d5e04a2a4100af4d8f61721099cb14af891c7e4 100644 (file)
@@ -16,7 +16,7 @@ public class MixinEntityRenderer {
     @Final
     private Minecraft mc;
 
-    @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))
+    @Inject(method = "updateCameraAndRender(FJ)V", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/profiler/IProfiler;func_219895_b(Ljava/lang/String;)V", args = "ldc=hand", shift = At.Shift.BEFORE))
     private void render(float partialTicks, long ignored, CallbackInfo ci) {
         ClientInterop.render(partialTicks, this.mc.player);
     }
index 71d3b7efa6cfce4f7416b2598066fdd22824a310..7bec464c18953a684f912f7671d52de3d3bf3506 100644 (file)
@@ -5,7 +5,9 @@ import net.minecraft.client.GameSettings;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.settings.KeyBinding;
 import org.apache.commons.lang3.ArrayUtils;
+import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Mutable;
 import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
@@ -15,15 +17,18 @@ import java.io.File;
 
 @Mixin(GameSettings.class)
 public abstract class MixinGameSettings {
+    @Mutable
+    @Final
     @Shadow
     public KeyBinding[] keyBindings;
 
     @Shadow
     public abstract void loadOptions();
 
-    @Inject(method = "<init>(Lnet/minecraft/client/Minecraft;Ljava/io/File;)V", at = @At("RETURN"))
+    @Inject(method = "<init>", at = @At("RETURN"))
     private void init(Minecraft minecraft, File file, CallbackInfo ci) {
         keyBindings = ArrayUtils.addAll(keyBindings, KeyListener.keyBindings());
         this.loadOptions();
     }
+
 }
index a53d2db102849d5bdb527b3ad110bb2bccff8a6a..2bcbd71cda3b202028a274b33e8a2200fbbffc72 100644 (file)
@@ -2,24 +2,24 @@ package com.irtimaled.bbor.mixin.network.play.client;
 
 import com.irtimaled.bbor.common.interop.CommonInterop;
 import com.irtimaled.bbor.common.messages.SubscribeToServer;
-import net.minecraft.network.NetHandlerPlayServer;
-import net.minecraft.network.play.INetHandlerPlayServer;
-import net.minecraft.network.play.client.CPacketCustomPayload;
+import net.minecraft.network.play.IServerPlayNetHandler;
+import net.minecraft.network.play.ServerPlayNetHandler;
+import net.minecraft.network.play.client.CCustomPayloadPacket;
 import net.minecraft.util.ResourceLocation;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Redirect;
 
-@Mixin(CPacketCustomPayload.class)
+@Mixin(CCustomPayloadPacket.class)
 public class MixinCPacketCustomPayload {
     @Shadow
     private ResourceLocation channel;
 
-    @Redirect(method = "processPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/INetHandlerPlayServer;processCustomPayload(Lnet/minecraft/network/play/client/CPacketCustomPayload;)V"))
-    private void processPacket(INetHandlerPlayServer netHandlerPlayServer, CPacketCustomPayload packet) {
+    @Redirect(method = "processPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/IServerPlayNetHandler;processCustomPayload(Lnet/minecraft/network/play/client/CCustomPayloadPacket;)V"))
+    private void processPacket(IServerPlayNetHandler netHandlerPlayServer, CCustomPayloadPacket packet) {
         if (this.channel.toString().equals(SubscribeToServer.NAME)) {
-            CommonInterop.playerSubscribed(((NetHandlerPlayServer) netHandlerPlayServer).player);
+            CommonInterop.playerSubscribed(((ServerPlayNetHandler) netHandlerPlayServer).player);
         } else {
             netHandlerPlayServer.processCustomPayload(packet);
         }
index a0ab1d64f72fd388222a030d9a4465a75a2b5982..39265d2df84d815b607a8f60141a1919a9f47e11 100644 (file)
@@ -2,23 +2,23 @@ package com.irtimaled.bbor.mixin.network.play.server;
 
 import com.irtimaled.bbor.common.EventBus;
 import com.irtimaled.bbor.common.messages.*;
-import net.minecraft.client.network.NetHandlerPlayClient;
+import net.minecraft.client.network.play.ClientPlayNetHandler;
+import net.minecraft.client.network.play.IClientPlayNetHandler;
 import net.minecraft.network.PacketBuffer;
-import net.minecraft.network.play.INetHandlerPlayClient;
-import net.minecraft.network.play.server.SPacketCustomPayload;
+import net.minecraft.network.play.server.SCustomPayloadPlayPacket;
 import net.minecraft.util.ResourceLocation;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Redirect;
 
-@Mixin(SPacketCustomPayload.class)
+@Mixin(SCustomPayloadPlayPacket.class)
 public abstract class MixinSPacketCustomPayload {
     @Shadow
     private ResourceLocation channel;
 
-    @Redirect(method = "processPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/play/INetHandlerPlayClient;handleCustomPayload(Lnet/minecraft/network/play/server/SPacketCustomPayload;)V"))
-    private void processPacket(INetHandlerPlayClient netHandlerPlayClient, SPacketCustomPayload packet) {
+    @Redirect(method = "processPacket", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/play/IClientPlayNetHandler;handleCustomPayload(Lnet/minecraft/network/play/server/SCustomPayloadPlayPacket;)V"))
+    private void processPacket(IClientPlayNetHandler netHandlerPlayClient, SCustomPayloadPlayPacket packet) {
         String channelName = channel.toString();
         if (channelName.startsWith("bbor:")) {
             PacketBuffer data = null;
@@ -28,7 +28,7 @@ public abstract class MixinSPacketCustomPayload {
                 switch (channelName) {
                     case InitializeClient.NAME: {
                         EventBus.publish(InitializeClient.getEvent(reader));
-                        ((NetHandlerPlayClient) netHandlerPlayClient).sendPacket(SubscribeToServer.getPayload().build());
+                        ((ClientPlayNetHandler) netHandlerPlayClient).sendPacket(SubscribeToServer.getPayload().build());
                         break;
                     }
                     case AddBoundingBox.NAME: {
index 6fcabe12086b69d059c6eef19dcabcc87dae6951..36123c392f77bfa9188612db1078741a95695535 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.mixin.network.play.server;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.network.play.server.SPacketSpawnPosition;
+import net.minecraft.network.play.server.SSpawnPositionPacket;
 import net.minecraft.util.math.BlockPos;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
-@Mixin(SPacketSpawnPosition.class)
+@Mixin(SSpawnPositionPacket.class)
 public abstract class MixinSPacketSpawnPosition {
     @Shadow
     private BlockPos spawnBlockPos;
index 21a1b4aeb53fd6cd0fbda083aac7c9652a1cddaa..08cb9b773ca0177d8bece1ec2a88671fcae3537b 100644 (file)
@@ -2,7 +2,7 @@ package com.irtimaled.bbor.mixin.server;
 
 import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.server.MinecraftServer;
-import net.minecraft.world.WorldServer;
+import net.minecraft.world.ServerWorld;
 import net.minecraft.world.dimension.DimensionType;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
@@ -17,9 +17,9 @@ import java.util.Map;
 public class MixinMinecraftServer {
     @Shadow
     @Final
-    private Map<DimensionType, WorldServer> worlds;
+    private Map<DimensionType, ServerWorld> worlds;
 
-    @Inject(method = "initialWorldChunkLoad", at = @At("HEAD"))
+    @Inject(method = "func_213186_a", at = @At("HEAD"))
     private void initialWorldChunkLoad(CallbackInfo ci) {
         CommonInterop.loadWorlds(worlds.values());
     }
index 09a54804b4dabcab43963679b010e7b92d88ccdb..6285832fcf56d9cf92cc5e62ef26ce2aab705d8f 100644 (file)
@@ -4,7 +4,7 @@ import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.block.Block;
 import net.minecraft.server.management.PlayerInteractionManager;
 import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.World;
+import net.minecraft.world.ServerWorld;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
 import org.spongepowered.asm.mixin.injection.At;
@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
 @Mixin(PlayerInteractionManager.class)
 public class MixinPlayerInteractionManager {
     @Shadow
-    public World world;
+    public ServerWorld world;
 
     @Inject(method = "tryHarvestBlock", at = @At("HEAD"))
     private void tryHarvestBlock(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
index 6eeb201d8b8377b3e079f0938d81891e5faf86cd..e296394a28abc1ac19cdd71fec1fa9a030e9aa30 100644 (file)
@@ -1,7 +1,8 @@
 package com.irtimaled.bbor.mixin.server.management;
 
 import com.irtimaled.bbor.common.interop.CommonInterop;
-import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.entity.player.ServerPlayerEntity;
+import net.minecraft.network.NetworkManager;
 import net.minecraft.server.management.PlayerList;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
@@ -10,13 +11,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(PlayerList.class)
 public class MixinPlayerList {
-    @Inject(method = "playerLoggedIn", at = @At("RETURN"))
-    private void playerLoggedIn(EntityPlayerMP player, CallbackInfo ci) {
+    @Inject(method = "initializeConnectionToPlayer", at = @At("RETURN"))
+    private void playerLoggedIn(NetworkManager networkManager, ServerPlayerEntity player, CallbackInfo ci) {
         CommonInterop.playerLoggedIn(player);
     }
 
     @Inject(method = "playerLoggedOut", at = @At("HEAD"))
-    private void playerLoggedOut(EntityPlayerMP player, CallbackInfo ci) {
+    private void playerLoggedOut(ServerPlayerEntity player, CallbackInfo ci) {
         CommonInterop.playerLoggedOut(player);
     }
 }
diff --git a/src/main/java/com/irtimaled/bbor/mixin/world/MixinWorldServer.java b/src/main/java/com/irtimaled/bbor/mixin/world/MixinWorldServer.java
deleted file mode 100644 (file)
index 99fbfde..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.irtimaled.bbor.mixin.world;
-
-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;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(WorldServer.class)
-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) {
-        CommonInterop.worldTick((WorldServer) (Object) this);
-    }
-}
index 7eb047611553c518632b5e9f0b34ae917b1b8047..dc5f146dcf475c982aa665b3d7184c1554f8b4c1 100644 (file)
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(Chunk.class)
 public class MixinChunk {
-    @Inject(method = "onLoad", at = @At("RETURN"))
+    @Inject(method = "func_217318_w", at = @At("RETURN"))
     private void onLoad(CallbackInfo ci) {
         CommonInterop.chunkLoaded((Chunk) (Object) this);
     }
index 763c54600141d007a4116a67d7dfac2d0ee0e2ee..9b869e7dc00046462a7b9692ddb3bfd3e4348b10 100644 (file)
@@ -29,6 +29,7 @@ public class ServerRunner {
     private static final ThrowableConsumer<URL> addURL;
 
     static {
+        VANILLA_SERVER_JARS.put("1.14", "https://launcher.mojang.com/v1/objects/f1a0073671057f01aa843443fef34330281333ce/server.jar");
         VANILLA_SERVER_JARS.put("1.13.2", "https://launcher.mojang.com/v1/objects/3737db93722a9e39eeada7c27e7aca28b144ffa7/server.jar");
         VANILLA_SERVER_JARS.put("1.13.1", "https://launcher.mojang.com/v1/objects/fe123682e9cb30031eae351764f653500b7396c9/server.jar");
         VANILLA_SERVER_JARS.put("1.13", "https://launcher.mojang.com/v1/objects/d0caafb8438ebd206f99930cfaecfa6c9a13dca0/server.jar");
index 4632988fc5b8b536162397afec38754d1f781a53..ba817360ece2a3a1162791f799458a6b70bbcc8f 100644 (file)
@@ -10,7 +10,6 @@
     "server.MixinMinecraftServer",
     "server.management.MixinPlayerInteractionManager",
     "server.management.MixinPlayerList",
-    "world.MixinWorldServer",
     "world.chunk.MixinChunk"
   ],
   "client": [