]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Upgrade to 1.14.2
authorIrtimaled <irtimaled@gmail.com>
Thu, 21 Nov 2019 05:00:17 +0000 (21:00 -0800)
committerIrtimaled <irtimaled@gmail.com>
Sat, 23 May 2020 06:43:51 +0000 (23:43 -0700)
75 files changed:
build.gradle
gradle.properties
src/main/java/com/irtimaled/bbor/client/Camera.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/Player.java
src/main/java/com/irtimaled/bbor/client/commands/CommandHelper.java
src/main/java/com/irtimaled/bbor/client/commands/HexColorArgument.java
src/main/java/com/irtimaled/bbor/client/commands/SpawningSphereCommand.java
src/main/java/com/irtimaled/bbor/client/config/BoundingBoxTypeHelper.java
src/main/java/com/irtimaled/bbor/client/config/ConfigManager.java
src/main/java/com/irtimaled/bbor/client/events/RemoveBoundingBoxReceived.java [deleted file]
src/main/java/com/irtimaled/bbor/client/gui/AbstractButton.java
src/main/java/com/irtimaled/bbor/client/gui/AbstractControl.java
src/main/java/com/irtimaled/bbor/client/gui/AbstractSlider.java
src/main/java/com/irtimaled/bbor/client/gui/BoolButton.java
src/main/java/com/irtimaled/bbor/client/gui/ControlList.java
src/main/java/com/irtimaled/bbor/client/gui/ControlListSection.java
src/main/java/com/irtimaled/bbor/client/gui/IntSettingSlider.java
src/main/java/com/irtimaled/bbor/client/gui/ListScreen.java
src/main/java/com/irtimaled/bbor/client/gui/LoadSavesScreen.java
src/main/java/com/irtimaled/bbor/client/gui/SearchField.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/gui/WorldSaveRow.java
src/main/java/com/irtimaled/bbor/client/interop/BiomeBorderHelper.java
src/main/java/com/irtimaled/bbor/client/interop/ClientInterop.java
src/main/java/com/irtimaled/bbor/client/interop/NBTStructureLoader.java
src/main/java/com/irtimaled/bbor/client/interop/SaveGameStructureLoader.java
src/main/java/com/irtimaled/bbor/client/interop/SpawnableBlocksHelper.java
src/main/java/com/irtimaled/bbor/client/interop/SpawningSphereHelper.java
src/main/java/com/irtimaled/bbor/client/keyboard/KeyListener.java
src/main/java/com/irtimaled/bbor/client/providers/BeaconProvider.java
src/main/java/com/irtimaled/bbor/client/providers/ConduitProvider.java
src/main/java/com/irtimaled/bbor/client/providers/MobSpawnerProvider.java
src/main/java/com/irtimaled/bbor/client/renderers/AbstractRenderer.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/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/messages/PayloadReader.java
src/main/java/com/irtimaled/bbor/common/messages/RemoveBoundingBox.java [deleted file]
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/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/MixinGuiChat.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/MixinSPacketChat.java
src/main/java/com/irtimaled/bbor/mixin/network/play/server/MixinSPacketCommandList.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/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 55fa7ef4dae4c6901320c5ce39650761fa5e7a57..80a121a5c539ffcb9bd568e61cc17e54a348dcec 100644 (file)
@@ -38,7 +38,7 @@ dependencies {
 
 minecraft {
     version = project.mcVersion
-    mappings = 'snapshot_20190227'
+    mappings = 'snapshot_20190624'
     runDir = 'run'
     tweakClass = 'com.irtimaled.bbor.launch.ClientTweaker'
     makeObfSourceJar = false
index d4424ecf7d212bbe2d6f0a5ed66a1d0cc8a9bcd7..fa85bd2184779f4e4b2eff38b9d575023200332b 100644 (file)
@@ -1,4 +1,4 @@
 name=bbor
 buildVersion=2.0b
 # leave a space to reduce merge conflicts on version change
-mcVersion=1.13.2
+mcVersion=1.14.2
diff --git a/src/main/java/com/irtimaled/bbor/client/Camera.java b/src/main/java/com/irtimaled/bbor/client/Camera.java
new file mode 100644 (file)
index 0000000..78ac439
--- /dev/null
@@ -0,0 +1,23 @@
+package com.irtimaled.bbor.client;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.math.Vec3d;
+
+public class Camera {
+    private static Vec3d getPos() {
+        return Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
+    }
+
+    public static double getX() {
+        return getPos().x;
+    }
+
+    public static double getY() {
+        return getPos().y;
+    }
+
+    public static double getZ() {
+        return getPos().z;
+    }
+}
+
index 61c707829f34f065089faf8b6132e95288a6b6ac..c09764cd08f55fd508af0df7857ccfb5abe04aea 100644 (file)
@@ -10,7 +10,6 @@ import com.irtimaled.bbor.client.providers.*;
 import com.irtimaled.bbor.common.BoundingBoxCache;
 import com.irtimaled.bbor.common.CommonProxy;
 import com.irtimaled.bbor.common.EventBus;
-import com.irtimaled.bbor.common.VillageColorCache;
 
 public class ClientProxy extends CommonProxy {
     public static void registerKeyBindings() {
@@ -34,7 +33,6 @@ public class ClientProxy extends CommonProxy {
         EventBus.subscribe(DisconnectedFromRemoteServer.class, e -> disconnectedFromServer());
         EventBus.subscribe(InitializeClientReceived.class, this::onInitializeClientReceived);
         EventBus.subscribe(AddBoundingBoxReceived.class, this::addBoundingBox);
-        EventBus.subscribe(RemoveBoundingBoxReceived.class, this::onRemoveBoundingBoxReceived);
         EventBus.subscribe(UpdateWorldSpawnReceived.class, this::onUpdateWorldSpawnReceived);
         EventBus.subscribe(SaveLoaded.class, e -> clear());
 
@@ -56,7 +54,6 @@ public class ClientProxy extends CommonProxy {
         CustomBeaconProvider.clear();
         CustomBoxProvider.clear();
         BiomeBorderProvider.clear();
-        VillageColorCache.clear();
         clearCaches();
     }
 
@@ -67,10 +64,6 @@ public class ClientProxy extends CommonProxy {
         cache.addBoundingBoxes(event.getKey(), event.getBoundingBoxes());
     }
 
-    private void onRemoveBoundingBoxReceived(RemoveBoundingBoxReceived event) {
-        super.removeBoundingBox(event.getDimensionId(), event.getKey());
-    }
-
     private void onInitializeClientReceived(InitializeClientReceived event) {
         setWorldSpawn(event.getSpawnX(), event.getSpawnZ());
         setSeed(event.getSeed());
index 66a5d1f0606b1c3a01f6ac02dc66b8ffb0566bbb..a2d611b33075569f26b783c805c61377ac1887fe 100644 (file)
@@ -9,7 +9,6 @@ import com.irtimaled.bbor.common.MathHelper;
 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
 import com.irtimaled.bbor.common.models.BoundingBoxCuboid;
 import com.irtimaled.bbor.common.models.BoundingBoxSphere;
-import com.irtimaled.bbor.common.models.BoundingBoxVillage;
 import org.lwjgl.opengl.GL11;
 
 import java.util.HashMap;
@@ -40,7 +39,6 @@ public class ClientRenderer {
     }
 
     static {
-        registerRenderer(BoundingBoxVillage.class, new VillageRenderer());
         registerRenderer(BoundingBoxSlimeChunk.class, new SlimeChunkRenderer());
         registerRenderer(BoundingBoxWorldSpawn.class, new WorldSpawnRenderer());
         registerRenderer(BoundingBoxCuboid.class, new CuboidRenderer());
index 1085a22c580ccc8153ba72b7377b8d52e374264b..2d518d0848a20aed5a60bc867db2d71fb2ebc332 100644 (file)
@@ -2,7 +2,7 @@ package com.irtimaled.bbor.client;
 
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.Point;
-import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.client.entity.player.ClientPlayerEntity;
 
 public class Player {
     private static double x;
@@ -11,7 +11,7 @@ public class Player {
     private static double activeY;
     private static int dimensionId;
 
-    public static void setPosition(double partialTicks, EntityPlayer player) {
+    public static void setPosition(double partialTicks, ClientPlayerEntity player) {
         x = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
         y = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
         z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
index 33918608ae27aed8f088b1b2ff19f830cd09ec67..bd432de5121f0bea5fb6c8302d95874201df15e1 100644 (file)
@@ -1,14 +1,15 @@
 package com.irtimaled.bbor.client.commands;
 
 import com.mojang.brigadier.context.CommandContext;
+import com.mojang.brigadier.context.ParsedCommandNode;
 import com.mojang.brigadier.tree.CommandNode;
 import com.mojang.brigadier.tree.LiteralCommandNode;
 import net.minecraft.command.CommandSource;
-import net.minecraft.util.text.TextComponentTranslation;
+import net.minecraft.util.text.TranslationTextComponent;
 
 class CommandHelper {
     static void feedback(CommandContext<CommandSource> context, String format, Object... values) {
-        context.getSource().sendFeedback(new TextComponentTranslation(format, values), false);
+        context.getSource().sendFeedback(new TranslationTextComponent(format, values), false);
     }
 
     static boolean lastNodeIsLiteral(CommandContext<CommandSource> context, String literal) {
@@ -21,7 +22,8 @@ class CommandHelper {
     }
 
     private static CommandNode getLastNode(CommandContext<CommandSource> context) {
-        CommandNode[] nodes = context.getNodes().keySet().toArray(new CommandNode[0]);
-        return nodes[nodes.length-1];
+        ParsedCommandNode[] nodes = context.getNodes().toArray(new ParsedCommandNode[0]);
+        if (nodes.length == 0) return null;
+        return nodes[nodes.length - 1].getNode();
     }
 }
index d7d890029c288ae019da89cfdf346c058eafdd8f..80dfc997d365181a0c8c3712cb6ee9b71e8cee04 100644 (file)
@@ -22,7 +22,7 @@ public class HexColorArgument implements ArgumentType<HexColor> {
     public static final SimpleCommandExceptionType EXPECTED_HEX_COLOR = new SimpleCommandExceptionType(new LiteralMessage("Expected hex color"));
 
     @Override
-    public <S> HexColor parse(StringReader reader) throws CommandSyntaxException {
+    public HexColor parse(StringReader reader) throws CommandSyntaxException {
         String value = reader.getRemaining().split(" ")[0].toLowerCase();
         if (value.isEmpty()) {
             throw EXPECTED_HEX_COLOR.createWithContext(reader);
index 312c1fc8dd93cb493d9f74b5d6153c1f78a4eb8c..1acb2ebe6a99b737fafb31a9f864219118d9eda7 100644 (file)
@@ -10,7 +10,7 @@ import net.minecraft.client.Minecraft;
 import net.minecraft.command.CommandSource;
 import net.minecraft.command.Commands;
 import net.minecraft.command.ISuggestionProvider;
-import net.minecraft.world.EnumLightType;
+import net.minecraft.world.LightType;
 import net.minecraft.world.World;
 
 public class SpawningSphereCommand {
@@ -42,7 +42,7 @@ public class SpawningSphereCommand {
                             World world = Minecraft.getInstance().world;
                             SpawningSphereProvider.calculateSpawnableSpacesCount(pos -> {
                                 counts.spawnable++;
-                                if(world.getLightFor(EnumLightType.SKY, pos) > 7)
+                                if(world.getLightFor(LightType.SKY, pos) > 7)
                                     counts.nightSpawnable++;
                             });
                             SpawningSphereProvider.setSpawnableSpacesCount(counts.spawnable);
index 4e663580c7c5c72834e77139f283fffaf6fa45b3..77818104c20d9d323288ba090981334db2c155a6 100644 (file)
@@ -41,7 +41,6 @@ public class BoundingBoxTypeHelper {
         registerType(BoundingBoxType.Igloo, ConfigManager.drawIgloos, ConfigManager.colorIgloos);
         registerType(BoundingBoxType.PillagerOutpost, ConfigManager.drawPillagerOutposts, ConfigManager.colorPillagerOutposts);
         registerType(BoundingBoxType.Village, ConfigManager.drawVillages, ConfigManager.colorVillages);
-        registerType(BoundingBoxType.VillageSpheres, ConfigManager.drawVillageSpheres, ConfigManager.colorVillages);
         registerType(BoundingBoxType.NetherFossil, ConfigManager.drawNetherFossils, ConfigManager.colorNetherFossils);
         registerType(BoundingBoxType.BastionRemnant, ConfigManager.drawBastionRemnants, ConfigManager.colorBastionRemnants);
         registerType(BoundingBoxType.RuinedPortal, ConfigManager.drawRuinedPortals, ConfigManager.colorRuinedPortals);
index 80992a9fc52cd6788cf256e4954bd66995dc78a5..6e2f8a3e86cfd1c268a83a5b7210d3d41446dd93 100644 (file)
@@ -18,8 +18,6 @@ public class ConfigManager {
     public static Setting<Boolean> drawNetherFortresses;
     public static Setting<Boolean> drawOceanMonuments;
     public static Setting<Boolean> alwaysVisible;
-    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;
@@ -37,9 +35,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 Setting<Boolean> drawVillageSpheres;
     public static Setting<Boolean> drawAFKSpheres;
     public static Setting<Boolean> renderAFKSpawnableBlocks;
     public static Setting<Integer> afkSpawnableBlocksRenderDistance;
@@ -118,12 +113,6 @@ public class ConfigManager {
         biomeBordersRenderDistance = setup(config, "biomeBorders", "biomeBordersRenderDistance", 3, "The distance from the player where biome borders will be drawn.");
         biomeBordersMaxY = setup(config, "biomeBorders", "biomeBordersMaxY", -1, "The maximum top of the biome borders. If set to -1 it will use the value when activated, if set to 0 it will always track the players feet.");
 
-        drawVillageSpheres = setup(config, "villages", "drawVillageSpheres", true, "If set to true village bounding spheres are drawn.");
-        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.");
-
         drawVillages = setup(config, "structures", "drawVillages", false, "If set to true village bounding boxes will be drawn.");
         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.");
diff --git a/src/main/java/com/irtimaled/bbor/client/events/RemoveBoundingBoxReceived.java b/src/main/java/com/irtimaled/bbor/client/events/RemoveBoundingBoxReceived.java
deleted file mode 100644 (file)
index a648627..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.irtimaled.bbor.client.events;
-
-import com.irtimaled.bbor.common.models.AbstractBoundingBox;
-
-public class RemoveBoundingBoxReceived {
-    private final int dimensionId;
-    private final AbstractBoundingBox key;
-
-    public RemoveBoundingBoxReceived(int dimensionId, AbstractBoundingBox key) {
-        this.dimensionId = dimensionId;
-        this.key = key;
-    }
-
-    public int getDimensionId() {
-        return dimensionId;
-    }
-
-    public AbstractBoundingBox getKey() {
-        return key;
-    }
-}
index 4951981c60a6d40edc78874773fb6f0b8e4f9938..1ceed2ea688677f4611868004812fc6bf0ef0fea 100644 (file)
@@ -7,16 +7,16 @@ abstract class AbstractButton extends AbstractControl {
 
     AbstractButton(int x, int y, int width, String name, boolean enabled) {
         this(x, y, width, name);
-        this.enabled = enabled;
+        this.active = enabled;
     }
 
     @Override
-    protected int getHoverState(boolean p_getHoverState_1_) {
+    protected int getYImage(boolean p_getHoverState_1_) {
         return getState();
     }
 
     protected int getState() {
-        return this.enabled ? this.hovered ? 2 : 1 : 0;
+        return this.active ? this.isHovered ? 2 : 1 : 0;
     }
 
     @Override
index 4dab97809c4557b9f77154c072df42deba3ef84d..839e280d6ba544bb46dfde4d0f593a8de4411944 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;
 
 import java.awt.*;
 
-abstract class AbstractControl extends GuiButton implements IControl {
+abstract class AbstractControl extends Widget implements IControl {
     private static final int PADDING = 4;
     protected final Minecraft minecraft;
 
     AbstractControl(int x, int y, int width, String name) {
-        super(0, x, y, width, 20, name);
+        super(x, y, width, 20, name);
         this.minecraft = Minecraft.getInstance();
     }
 
@@ -41,7 +41,7 @@ abstract class AbstractControl extends GuiButton implements IControl {
 
     @Override
     protected void renderBg(Minecraft minecraft, int mouseX, int mouseY) {
-        if (enabled) renderBackground(mouseX, mouseY);
+        if (active) renderBackground(mouseX, mouseY);
     }
 
     protected void renderBackground(int mouseX, int mouseY) {
@@ -59,13 +59,13 @@ abstract class AbstractControl extends GuiButton implements IControl {
 
     @Override
     public void filter(String lowerValue) {
-        String lowerString = this.displayString.toLowerCase();
+        String lowerString = this.getMessage().toLowerCase();
         this.setVisible(lowerValue.equals("") ||
                 lowerString.startsWith(lowerValue) ||
                 lowerString.contains(" " + lowerValue));
     }
 
     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 0cd402460d4aa410d31a16a9d2ddf943b18be581..d16d3ca9fea6d13464491d9b666aea51649d653e 100644 (file)
@@ -13,15 +13,15 @@ abstract class AbstractSlider extends AbstractControl {
 
     @Override
     protected void renderBackground(int mouseX, int mouseY) {
-        this.minecraft.getTextureManager().bindTexture(BUTTON_TEXTURES);
+        this.minecraft.getTextureManager().bindTexture(WIDGETS_LOCATION);
         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
         if(isDragging) {
             changeProgress(mouseX);
         }
 
-        int hoverState = super.getHoverState(this.hovered);
-        this.drawTexturedModalRect(this.x + (int) (this.progress * (double) (this.width - 8)), this.y, 0, 46 + hoverState * 20, 4, this.height);
-        this.drawTexturedModalRect(this.x + (int) (this.progress * (double) (this.width - 8)) + 4, this.y, 196, 46 + hoverState * 20, 4, 20);
+        int hoverState = super.getYImage(this.isHovered);
+        this.blit(this.x + (int) (this.progress * (double) (this.width - 8)), this.y, 0, 46 + hoverState * 20, 4, this.height);
+        this.blit(this.x + (int) (this.progress * (double) (this.width - 8)) + 4, this.y, 196, 46 + hoverState * 20, 4, 20);
     }
 
     boolean setProgress(double progress) {
@@ -41,7 +41,7 @@ abstract class AbstractSlider extends AbstractControl {
     }
 
     @Override
-    protected int getHoverState(boolean hovered) {
+    protected int getYImage(boolean hovered) {
         return 0;
     }
 
index c2fded4b65b782bc477315233327aed8ab241e3a..f61e5dbb8bfad3ff6d361d80da5b7eb58c198955 100644 (file)
@@ -16,7 +16,7 @@ public abstract class BoolButton extends AbstractButton {
 
     @Override
     protected int getState() {
-        return enabled ? super.getState() : 0;
+        return active ? super.getState() : 0;
     }
 
     protected boolean getValue() {
index 954d65da8f849893aec9a92b634ec36bcacaf285..00f9d81535066a7378edc1c6cae52c4d5635560e 100644 (file)
@@ -1,11 +1,11 @@
 package com.irtimaled.bbor.client.gui;
 
 import com.irtimaled.bbor.client.renderers.Renderer;
+import com.mojang.blaze3d.platform.GLX;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiEventHandler;
+import net.minecraft.client.gui.AbstractGui;
+import net.minecraft.client.gui.FocusableGui;
 import net.minecraft.client.gui.IGuiEventListener;
-import net.minecraft.client.renderer.OpenGlHelper;
 import net.minecraft.util.math.MathHelper;
 import org.lwjgl.opengl.GL11;
 
@@ -13,7 +13,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-public class ControlList extends GuiEventHandler {
+public class ControlList extends FocusableGui {
     private static final int CONTROLS_WIDTH = 310;
     private final int scrollBarLeft;
     private final int listHeight;
@@ -156,7 +156,7 @@ public class ControlList extends GuiEventHandler {
     }
 
     @Override
-    public boolean mouseScrolled(double scrollAmount) {
+    public boolean mouseScrolled(double mouseX, double mouseY, double scrollAmount) {
         this.amountScrolled -= scrollAmount * 10;
         return true;
     }
@@ -176,7 +176,7 @@ public class ControlList extends GuiEventHandler {
         this.overlayBackground(0, this.top);
         this.overlayBackground(this.bottom, this.height);
         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(GL11.GL_SMOOTH);
         GL11.glDisable(GL11.GL_TEXTURE_2D);
@@ -194,7 +194,7 @@ public class ControlList extends GuiEventHandler {
     }
 
     private void drawListBackground() {
-        this.minecraft.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
+        this.minecraft.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION);
         Renderer.startTextured()
                 .setColor(32, 32, 32)
                 .setAlpha(255)
@@ -239,7 +239,7 @@ public class ControlList extends GuiEventHandler {
     }
 
     private void overlayBackground(int top, int bottom) {
-        this.minecraft.getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
+        this.minecraft.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION);
         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
         Renderer.startTextured()
                 .setColor(64, 64, 64)
@@ -303,7 +303,7 @@ public class ControlList extends GuiEventHandler {
     }
 
     @Override
-    protected List<? extends IGuiEventListener> getChildren() {
+    public List<? extends IGuiEventListener> children() {
         return Collections.emptyList();
     }
 
index cdd15524f233554680da95c419313a12ec9f896a..4135bc9beab6dce8040a04a0cc1b48a71671972a 100644 (file)
@@ -36,7 +36,7 @@ public class ControlListSection extends ControlListEntry {
     }
 
     private int columnCount() {
-        switch (minecraft.getLanguageManager().getCurrentLanguage().getLanguageCode()){
+        switch (minecraft.getLanguageManager().getCurrentLanguage().getCode()){
             case "en_au":
             case "en_us":
             case "en_gb": return 3;
index 587bb467d0ef38619d2aaf0e21dde2f7e56e8176..34fadec2468c77f68fa8f41bfa59269f3c6c3ca9 100644 (file)
@@ -47,7 +47,7 @@ class IntSettingSlider extends AbstractSlider {
 
     @Override
     protected void updateText() {
-        this.displayString = this.getDisplayValue();
+        this.setMessage(this.getDisplayValue());
     }
 
     @Override
index 2339ac86ba846f51d6334415c0afd0b6e8409bf6..6b5dcf0222a978d2579a1e5fbd5802027590e727 100644 (file)
@@ -1,18 +1,19 @@
 package com.irtimaled.bbor.client.gui;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.screen.Screen;
 import net.minecraft.client.resources.I18n;
+import net.minecraft.util.text.StringTextComponent;
 
-public abstract class ListScreen extends GuiScreen {
-    private final GuiScreen lastScreen;
+public abstract class ListScreen extends Screen {
+    private final Screen lastScreen;
 
     private AbstractButton doneButton;
-    private String title;
     private ControlList controlList;
     private SearchField searchField;
 
-    ListScreen(GuiScreen lastScreen) {
+    ListScreen(Screen lastScreen) {
+        super(new StringTextComponent("Bounding Box Outline Reloaded"));
         this.lastScreen = lastScreen;
     }
 
@@ -25,10 +26,9 @@ public abstract class ListScreen extends GuiScreen {
     }
 
     @Override
-    protected void initGui() {
-        this.title = "Bounding Box Outline Reloaded";
+    protected void init() {
         this.controlList = new ControlList(this.width, this.height, 48, this.height - 28);
-        this.searchField = new SearchField(this.fontRenderer, this.width / 2 - 100, 22, 200, 20, this.controlList);
+        this.searchField = new SearchField(this.font, this.width / 2 - 100, 22, 200, 20, this.controlList);
         this.doneButton = new AbstractButton(this.width / 2 - 100, this.height - 24, 200, I18n.format("gui.done")) {
             @Override
             public void onPressed() {
@@ -52,7 +52,7 @@ public abstract class ListScreen extends GuiScreen {
     protected void render(int mouseX, int mouseY) {
         this.controlList.render(mouseX, mouseY);
 
-        this.drawCenteredString(this.fontRenderer, this.title, this.width / 2, 8, 16777215);
+        this.drawCenteredString(this.font, this.title.getUnformattedComponentText(), this.width / 2, 8, 16777215);
         this.searchField.render(mouseX, mouseY);
         this.doneButton.render(mouseX, mouseY);
     }
@@ -73,12 +73,12 @@ public abstract class ListScreen extends GuiScreen {
     }
 
     @Override
-    public boolean mouseScrolled(double scrollAmount) {
-        return this.controlList.mouseScrolled(scrollAmount);
+    public boolean mouseScrolled(double mouseX, double mouseY, double scrollAmount) {
+        return this.controlList.mouseScrolled(mouseX, mouseY, scrollAmount);
     }
 
     @Override
-    public void onGuiClosed() {
+    public void removed() {
         this.controlList.close();
     }
 
index 07d9e0e2162e6444504fda6e623de7e6c9d35590..d26c6793046fdcb64368e03d7db6076d8f7683a3 100644 (file)
@@ -2,7 +2,7 @@ package com.irtimaled.bbor.client.gui;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
 import net.minecraft.client.AnvilConverterException;
-import net.minecraft.world.storage.ISaveFormat;
+import net.minecraft.world.storage.SaveFormat;
 import net.minecraft.world.storage.WorldSummary;
 
 import java.util.List;
@@ -17,7 +17,7 @@ public class LoadSavesScreen extends ListScreen {
         ControlList controlList = this.getControlList();
         controlList.showSelectionBox();
         try {
-            final ISaveFormat saveLoader = this.mc.getSaveLoader();
+            final SaveFormat saveLoader = this.minecraft.getSaveLoader();
             List<WorldSummary> saveList = saveLoader.getSaveList();
             saveList.sort(null);
             saveList.forEach(world -> controlList.add(new WorldSaveRow(world, saveLoader)));
@@ -34,7 +34,7 @@ public class LoadSavesScreen extends ListScreen {
     @Override
     public void render(int mouseX, int mouseY, float unknown) {
         ControlListEntry selectedEntry = this.getControlList().getSelectedEntry();
-        this.getDoneButton().enabled = selectedEntry != null && selectedEntry.getVisible();
+        this.getDoneButton().active = selectedEntry != null && selectedEntry.getVisible();
         super.render(mouseX, mouseY, unknown);
     }
 }
index 9da258133f0c924fdb5ab2b486a6dc8b39c13b03..4778f4d163c71a50adab7d7a34f38a65c4c93ea3 100644 (file)
@@ -1,16 +1,16 @@
 package com.irtimaled.bbor.client.gui;
 
 import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.GuiTextField;
+import net.minecraft.client.gui.widget.TextFieldWidget;
 
-public class SearchField extends GuiTextField {
+public class SearchField extends TextFieldWidget {
     private final ControlList controlList;
 
     SearchField(FontRenderer fontRenderer, int left, int top, int width, int height, ControlList controlList) {
-        super(0, fontRenderer, left, top, width, height);
+        super(fontRenderer, left, top, width, height, "");
 
         this.controlList = controlList;
-        this.setTextAcceptHandler((id, text) -> this.controlList.filter(removeLeadingSpaces(text.toLowerCase())));
+        this.func_212954_a(text -> this.controlList.filter(removeLeadingSpaces(text.toLowerCase())));
         this.setTextFormatter((text, id) -> removeLeadingSpaces(text));
         this.setFocused(true);
         this.setCanLoseFocus(false);
@@ -21,7 +21,7 @@ public class SearchField extends GuiTextField {
     }
 
     public void render(int mouseX, int mouseY) {
-        this.drawTextField(mouseX, mouseY, 0f);
+        this.render(mouseX, mouseY, 0f);
     }
 
     @Override
index 9a05b5d6721440e36e515c957b107bbd7058e560..d8db2656091782868dc2e91e55b3e3903ddfaef4 100644 (file)
@@ -4,8 +4,9 @@ import com.irtimaled.bbor.client.ClientRenderer;
 import com.irtimaled.bbor.client.config.ConfigManager;
 import com.irtimaled.bbor.client.interop.ClientInterop;
 import com.irtimaled.bbor.common.BoundingBoxType;
-import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.screen.Screen;
 import net.minecraft.client.resources.I18n;
+import net.minecraft.util.SharedConstants;
 
 public class SettingsScreen extends ListScreen {
     private static final String pillagerOutpostVersionPattern = "(?:1\\.1[4-9]|1\\.[2-9][0-9]|18w(?:4[7-9]|5[0-9])|19w|2[0-9]w).*";
@@ -16,7 +17,7 @@ public class SettingsScreen extends ListScreen {
         ClientInterop.displayScreen(new SettingsScreen(null));
     }
 
-    SettingsScreen(GuiScreen lastScreen) {
+    SettingsScreen(Screen lastScreen) {
         super(lastScreen);
     }
 
@@ -28,13 +29,13 @@ public class SettingsScreen extends ListScreen {
 
     @Override
     protected void setup() {
-        String version = this.mc.getVersion();
+        String version = SharedConstants.getVersion().getName();
         ControlList controlList = this.getControlList();
-        if (this.mc.world != null) controlList.setTransparentBackground();
+        if (this.minecraft.world != null) controlList.setTransparentBackground();
 
         controlList
                 .section(null,
-                        (x, width) -> new BoolButton(width, I18n.format("bbor.options.active"), this.mc.world != null) {
+                        (x, width) -> new BoolButton(width, I18n.format("bbor.options.active"), this.minecraft.world != null) {
                             @Override
                             public void onPressed() {
                                 ClientRenderer.toggleActive();
@@ -100,17 +101,6 @@ public class SettingsScreen extends ListScreen {
                         (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.fortresses"), BoundingBoxType.NetherFortress),
                         (x, width) -> version.matches(netherFossilVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.netherFossils"), BoundingBoxType.NetherFossil) : null,
                         (x, width) -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.bastionRemnants"), BoundingBoxType.BastionRemnant) : null,
-                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.endCities"), BoundingBoxType.EndCity))
-                .section(I18n.format("bbor.tabs.villages"),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.villageSpheres"), ConfigManager.drawVillageSpheres),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.villageSpheres.doorLines"), ConfigManager.drawVillageDoors),
-                        (x, width) -> new BoolSettingButton(width, I18n.format("bbor.features.villageSpheres.golemSpawn"), ConfigManager.drawIronGolemSpawnArea),
-                        (x, width) -> new IntSettingSlider(width, 1, 5, "bbor.features.villageSpheres.dotSize", ConfigManager.villageSphereDotSize),
-                        (x, width) -> new IntSettingSlider(width, 1, 5, "bbor.features.villageSpheres.density", ConfigManager.villageSphereDensity)
-                                .addDisplayValue(1, I18n.format("bbor.features.villageSpheres.density.fewest"))
-                                .addDisplayValue(2, I18n.format("bbor.features.villageSpheres.density.fewer"))
-                                .addDisplayValue(3, I18n.format("bbor.features.villageSpheres.density.normal"))
-                                .addDisplayValue(4, I18n.format("bbor.features.villageSpheres.density.more"))
-                                .addDisplayValue(5, I18n.format("bbor.features.villageSpheres.density.most")));
+                        (x, width) -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.endCities"), BoundingBoxType.EndCity));
     }
 }
index 32a977d78b7960f61f5a6009ad9a3e98ed9e18fb..9587ab8a8271db968c7f8f8c1290cb00629602ef 100644 (file)
@@ -1,12 +1,12 @@
 package com.irtimaled.bbor.client.gui;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-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 x, int y, int width, String label, GuiScreen lastScreen) {
+    public SettingsScreenButton(int x, int y, int width, String label, Screen lastScreen) {
         super(x, y, width, label);
         screen = new SettingsScreen(lastScreen);
     }
index 5f26c74bdcfb2f56227a1673d4fadc39c92d5542..5dde418443244ec29f0d0deccbb9a0a2cb1969b9 100644 (file)
@@ -3,12 +3,12 @@ package com.irtimaled.bbor.client.gui;
 import com.google.common.hash.Hashing;
 import com.irtimaled.bbor.client.interop.ClientInterop;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.AbstractGui;
 import net.minecraft.client.renderer.texture.DynamicTexture;
 import net.minecraft.client.renderer.texture.NativeImage;
 import net.minecraft.util.ResourceLocation;
 import net.minecraft.util.Util;
-import net.minecraft.world.storage.ISaveFormat;
+import net.minecraft.world.storage.SaveFormat;
 import net.minecraft.world.storage.WorldInfo;
 import net.minecraft.world.storage.WorldSummary;
 import org.apache.logging.log4j.LogManager;
@@ -29,14 +29,14 @@ public class WorldSaveRow extends ControlListEntry implements Comparable<WorldSa
     private static final int ICON_SIZE = 20;
     private final Minecraft client;
     private final WorldSummary worldSummary;
-    private final ISaveFormat saveLoader;
+    private final SaveFormat saveLoader;
     private final ResourceLocation iconLocation;
     private final DynamicTexture icon;
 
     private File iconFile;
     private long lastClickTime;
 
-    WorldSaveRow(WorldSummary worldSummary, ISaveFormat saveLoader) {
+    WorldSaveRow(WorldSummary worldSummary, SaveFormat saveLoader) {
         this.worldSummary = worldSummary;
         this.saveLoader = saveLoader;
         this.client = Minecraft.getInstance();
@@ -101,7 +101,7 @@ public class WorldSaveRow extends ControlListEntry implements Comparable<WorldSa
         this.client.fontRenderer.drawString(details, (float) (x + ICON_SIZE + 3), (float) (y + 1 + this.client.fontRenderer.FONT_HEIGHT + 1), 8421504);
         this.client.getTextureManager().bindTexture(this.icon != null ? this.iconLocation : ICON_MISSING);
         GL11.glEnable(GL11.GL_BLEND);
-        Gui.drawModalRectWithCustomSizedTexture(x, y, 0.0F, 0.0F, ICON_SIZE, ICON_SIZE, 32.0F, 32.0F);
+        AbstractGui.blit(x, y, 0.0F, 0.0F, ICON_SIZE, ICON_SIZE, 32, 32);
         GL11.glDisable(GL11.GL_BLEND);
     }
 
index 07cf63e1deed0de06e8c9666ab717229fa9c0dac..90e596feed45f12954011b589bb9682681ec89ec 100644 (file)
@@ -3,7 +3,7 @@ package com.irtimaled.bbor.client.interop;
 import com.irtimaled.bbor.common.models.Coords;
 import net.minecraft.client.Minecraft;
 import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.registry.IRegistry;
+import net.minecraft.util.registry.Registry;
 import net.minecraft.world.biome.Biome;
 
 public class BiomeBorderHelper {
@@ -14,6 +14,6 @@ public class BiomeBorderHelper {
     public static int getBiomeId(int x, int y, int z) {
         BlockPos pos = new BlockPos(x, y, z);
         Biome biome = Minecraft.getInstance().world.getBiome(pos);
-        return IRegistry.BIOME.getId(biome);
+        return Registry.BIOME.getId(biome);
     }
 }
index 4e59342029a4dd57091b218facda072c0f328bba..61265f248dede56177f1fd0be77bb68ae8d8e1d8 100644 (file)
@@ -12,9 +12,9 @@ import com.irtimaled.bbor.common.TypeHelper;
 import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.EntityPlayerSP;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.network.NetHandlerPlayClient;
+import net.minecraft.client.entity.player.ClientPlayerEntity;
+import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.network.play.ClientPlayNetHandler;
 import net.minecraft.command.CommandSource;
 import net.minecraft.command.ISuggestionProvider;
 import net.minecraft.util.math.BlockPos;
@@ -27,14 +27,14 @@ public class ClientInterop {
         EventBus.publish(new DisconnectedFromRemoteServer());
     }
 
-    public static void render(float partialTicks, EntityPlayerSP player) {
+    public static void render(float partialTicks, ClientPlayerEntity player) {
         Player.setPosition(partialTicks, player);
         ClientRenderer.render(player.dimension.getId());
     }
 
     public static boolean interceptChatMessage(String message) {
         if (message.startsWith("/bbor:")) {
-            NetHandlerPlayClient connection = Minecraft.getInstance().getConnection();
+            ClientPlayNetHandler connection = Minecraft.getInstance().getConnection();
             if (connection != null) {
                 CommandDispatcher<ISuggestionProvider> commandDispatcher = connection.func_195515_i();
                 CommandSource commandSource = Minecraft.getInstance().player.getCommandSource();
@@ -43,7 +43,7 @@ public class ClientInterop {
                 } catch (CommandSyntaxException exception) {
                     commandSource.sendErrorMessage(TextComponentUtils.toTextComponent(exception.getRawMessage()));
                     if (exception.getInput() != null && exception.getCursor() >= 0) {
-                        ITextComponent suggestion = new TextComponentString("")
+                        ITextComponent suggestion = new StringTextComponent("")
                                 .applyTextStyle(TextFormatting.GRAY)
                                 .applyTextStyle(style -> style.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, message)));
                         int textLength = Math.min(exception.getInput().length(), exception.getCursor());
@@ -53,11 +53,11 @@ public class ClientInterop {
 
                         suggestion.appendText(exception.getInput().substring(Math.max(0, textLength - 10), textLength));
                         if (textLength < exception.getInput().length()) {
-                            suggestion.appendSibling(new TextComponentString(exception.getInput().substring(textLength))
+                            suggestion.appendSibling(new StringTextComponent(exception.getInput().substring(textLength))
                                     .applyTextStyles(TextFormatting.RED, TextFormatting.UNDERLINE));
                         }
 
-                        suggestion.appendSibling(new TextComponentTranslation("command.context.here")
+                        suggestion.appendSibling(new TranslationTextComponent("command.context.here")
                                 .applyTextStyles(TextFormatting.RED, TextFormatting.ITALIC));
                         commandSource.sendErrorMessage(suggestion);
                     }
@@ -77,7 +77,7 @@ public class ClientInterop {
     }
 
     public static void handleSeedMessage(ITextComponent chatComponent) {
-        TypeHelper.doIfType(chatComponent, TextComponentTranslation.class, message -> {
+        TypeHelper.doIfType(chatComponent, TranslationTextComponent.class, message -> {
             if (!message.getKey().equals("commands.seed.success")) return;
 
             try {
@@ -115,7 +115,7 @@ public class ClientInterop {
         SaveGameStructureLoader.clear();
     }
 
-    public static void displayScreen(GuiScreen screen) {
+    public static void displayScreen(Screen screen) {
         Minecraft.getInstance().displayGuiScreen(screen);
     }
 }
index c15b2e1eb7c6b6d8fe8da7358c286919ee87c744..2affcc538889e99bd9f2b95299f50636e18a8381 100644 (file)
@@ -2,22 +2,22 @@ package com.irtimaled.bbor.client.interop;
 
 import com.irtimaled.bbor.common.EventBus;
 import com.irtimaled.bbor.common.events.StructuresLoaded;
-import net.minecraft.nbt.CompressedStreamTools;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
+import net.minecraft.nbt.CompoundNBT;
+import net.minecraft.nbt.ListNBT;
 import net.minecraft.util.math.ChunkPos;
 import net.minecraft.util.math.MutableBoundingBox;
 import net.minecraft.world.IWorld;
+import net.minecraft.world.biome.Biome;
 import net.minecraft.world.chunk.storage.RegionFileCache;
 import net.minecraft.world.dimension.DimensionType;
+import net.minecraft.world.gen.ChunkGenerator;
 import net.minecraft.world.gen.feature.structure.LegacyStructureDataUtil;
 import net.minecraft.world.gen.feature.structure.StructurePiece;
 import net.minecraft.world.gen.feature.structure.StructureStart;
 import net.minecraft.world.gen.feature.template.TemplateManager;
-import net.minecraft.world.storage.ISaveHandler;
-import net.minecraft.world.storage.WorldSavedDataStorage;
+import net.minecraft.world.storage.DimensionSavedDataManager;
+import net.minecraft.world.storage.SaveHandler;
 
-import java.io.DataInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.util.*;
@@ -27,10 +27,11 @@ class NBTStructureLoader {
     private final Set<String> loadedChunks = new HashSet<>();
 
     private LegacyStructureDataUtil legacyStructureDataUtil = null;
-    private ISaveHandler saveHandler = null;
+    private SaveHandler saveHandler = null;
     private File chunkSaveLocation = null;
+    private ChunkLoader chunkLoader;
 
-    NBTStructureLoader(int dimensionId, ISaveHandler saveHandler, File worldDirectory) {
+    NBTStructureLoader(int dimensionId, SaveHandler saveHandler, File worldDirectory) {
         this.dimensionId = dimensionId;
         this.configure(saveHandler, worldDirectory);
     }
@@ -39,36 +40,42 @@ class NBTStructureLoader {
         this.saveHandler = null;
         this.chunkSaveLocation = null;
         this.loadedChunks.clear();
+
+        if(this.chunkLoader == null) return;
+        try {
+            this.chunkLoader.close();
+        } catch (IOException ignored) {
+        }
     }
 
-    void configure(ISaveHandler saveHandler, File worldDirectory) {
+    void configure(SaveHandler saveHandler, File worldDirectory) {
         this.saveHandler = saveHandler;
-        if(worldDirectory != null) {
-            this.chunkSaveLocation = DimensionType.getById(dimensionId).getDirectory(worldDirectory);
+        if (worldDirectory != null) {
+            this.chunkSaveLocation = new File(DimensionType.getById(dimensionId).getDirectory(worldDirectory), "region");
+            this.chunkLoader = new ChunkLoader(this.chunkSaveLocation);
         }
     }
 
     private LegacyStructureDataUtil getLegacyStructureDataUtil() {
         if (this.legacyStructureDataUtil == null) {
-            this.legacyStructureDataUtil = LegacyStructureDataUtil.func_212183_a(DimensionType.getById(dimensionId), new WorldSavedDataStorage(saveHandler));
+            File dataFolder = new File(DimensionType.OVERWORLD.getDirectory(this.saveHandler.getWorldDirectory()), "data");
+            this.legacyStructureDataUtil = LegacyStructureDataUtil.func_215130_a(DimensionType.getById(dimensionId),
+                    new DimensionSavedDataManager(dataFolder, this.saveHandler.getFixer()));
         }
         return this.legacyStructureDataUtil;
     }
 
-    private NBTTagCompound loadStructureStarts(int chunkX, int chunkZ) {
+    private CompoundNBT loadStructureStarts(int chunkX, int chunkZ) {
         try {
-            DataInputStream stream = RegionFileCache.getChunkInputStream(chunkSaveLocation, chunkX, chunkZ);
-            if (stream != null) {
-                NBTTagCompound compound = CompressedStreamTools.read(stream);
-                stream.close();
-                int dataVersion = compound.contains("DataVersion", 99) ? compound.getInt("DataVersion") : -1;
-                if (dataVersion < 1493) {
-                    if (compound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
-                        compound = getLegacyStructureDataUtil().func_212181_a(compound);
-                    }
+            CompoundNBT compound = this.chunkLoader.readChunk(chunkX, chunkZ);
+            if (compound == null) return null;
+            int dataVersion = compound.contains("DataVersion", 99) ? compound.getInt("DataVersion") : -1;
+            if (dataVersion < 1493) {
+                if (compound.getCompound("Level").getBoolean("hasLegacyStructureData")) {
+                    compound = getLegacyStructureDataUtil().func_212181_a(compound);
                 }
-                return compound.getCompound("Level").getCompound("Structures").getCompound("Starts");
             }
+            return compound.getCompound("Level").getCompound("Structures").getCompound("Starts");
         } catch (IOException ignored) {
         }
         return null;
@@ -79,12 +86,12 @@ class NBTStructureLoader {
 
         if (!loadedChunks.add(String.format("%s,%s", chunkX, chunkZ))) return;
 
-        NBTTagCompound structureStarts = loadStructureStarts(chunkX, chunkZ);
+        CompoundNBT structureStarts = loadStructureStarts(chunkX, chunkZ);
         if (structureStarts == null || structureStarts.size() == 0) return;
 
         Map<String, StructureStart> structureStartMap = new HashMap<>();
         for (String key : structureStarts.keySet()) {
-            NBTTagCompound compound = structureStarts.getCompound(key);
+            CompoundNBT compound = structureStarts.getCompound(key);
             if (compound.contains("BB")) {
                 structureStartMap.put(key, new SimpleStructureStart(compound));
             }
@@ -94,28 +101,36 @@ class NBTStructureLoader {
     }
 
     private static class SimpleStructureStart extends StructureStart {
-        SimpleStructureStart(NBTTagCompound compound) {
-            this.boundingBox = new MutableBoundingBox(compound.getIntArray("BB"));
-
-            NBTTagList children = compound.getList("Children", 10);
+        SimpleStructureStart(CompoundNBT compound) {
+            super(null,
+                    0,
+                    0,
+                    null,
+                    new MutableBoundingBox(compound.getIntArray("BB")),
+                    0,
+                    0);
+
+            ListNBT children = compound.getList("Children", 10);
             for (int index = 0; index < children.size(); ++index) {
-                NBTTagCompound child = children.getCompound(index);
+                CompoundNBT child = children.getCompound(index);
                 if (child.contains("BB")) this.components.add(new SimpleStructurePiece(child));
             }
         }
+
+        @Override
+        public void init(ChunkGenerator<?> chunkGenerator, TemplateManager templateManager, int i, int i1, Biome biome) {
+
+        }
     }
 
     private static class SimpleStructurePiece extends StructurePiece {
-        SimpleStructurePiece(NBTTagCompound compound) {
-            this.boundingBox = new MutableBoundingBox(compound.getIntArray("BB"));
+        SimpleStructurePiece(CompoundNBT compound) {
+            super(null, compound);
         }
 
         @Override
-        protected void writeAdditional(NBTTagCompound nbtTagCompound) {
-        }
+        protected void readAdditional(CompoundNBT compoundNBT) {
 
-        @Override
-        protected void readAdditional(NBTTagCompound nbtTagCompound, TemplateManager templateManager) {
         }
 
         @Override
@@ -123,4 +138,21 @@ class NBTStructureLoader {
             return false;
         }
     }
+
+    private static class ChunkLoader {
+        private final RegionFileCache regionFileCache;
+
+        public ChunkLoader(File file) {
+            this.regionFileCache = new RegionFileCache(file) {
+            };
+        }
+
+        public CompoundNBT readChunk(int chunkX, int chunkZ) throws IOException {
+            return regionFileCache.readChunk(new ChunkPos(chunkX, chunkZ));
+        }
+
+        public void close() throws IOException {
+            regionFileCache.close();
+        }
+    }
 }
index 3802936813daadf3781ee4af2ab5587c841ef582..407adc921ea00d591eb10d50377b2a7c74e375a2 100644 (file)
@@ -2,9 +2,8 @@ package com.irtimaled.bbor.client.interop;
 
 import com.irtimaled.bbor.client.Player;
 import net.minecraft.client.Minecraft;
-import net.minecraft.world.chunk.storage.RegionFileCache;
-import net.minecraft.world.storage.ISaveFormat;
-import net.minecraft.world.storage.ISaveHandler;
+import net.minecraft.world.storage.SaveFormat;
+import net.minecraft.world.storage.SaveHandler;
 
 import java.io.File;
 import java.util.HashMap;
@@ -12,14 +11,14 @@ import java.util.Map;
 
 public class SaveGameStructureLoader {
     private static final Map<Integer, NBTStructureLoader> nbtStructureLoaders = new HashMap<>();
-    private static ISaveHandler saveHandler = null;
+    private static SaveHandler saveHandler = null;
     private static File worldDirectory = null;
 
     static void loadSaveGame(String fileName) {
         Minecraft minecraft = Minecraft.getInstance();
-        ISaveFormat saveLoader = minecraft.getSaveLoader();
+        SaveFormat saveLoader = minecraft.getSaveLoader();
         saveHandler = saveLoader.getSaveLoader(fileName, null);
-        worldDirectory = saveLoader.getWorldFolder(fileName).toFile();
+        worldDirectory = saveLoader.func_215781_c().resolve(fileName).toFile();
 
         for (int dimensionId : nbtStructureLoaders.keySet()) {
             NBTStructureLoader dimensionProcessor = getNBTStructureLoader(dimensionId);
@@ -63,6 +62,5 @@ public class SaveGameStructureLoader {
         nbtStructureLoaders.clear();
         saveHandler = null;
         worldDirectory = null;
-        RegionFileCache.clearRegionFileReferences();
     }
 }
index e4d76379922565d45b8904ec1c3273e171835211..016d5c3175759be137767fd1068b5737b2125d83 100644 (file)
@@ -2,18 +2,22 @@ package com.irtimaled.bbor.client.interop;
 
 import com.irtimaled.bbor.common.models.Coords;
 import net.minecraft.block.Block;
-import net.minecraft.block.state.IBlockState;
+import net.minecraft.block.BlockState;
 import net.minecraft.client.Minecraft;
-import net.minecraft.entity.EnumCreatureType;
-import net.minecraft.init.Blocks;
+import net.minecraft.entity.EntityClassification;
+import net.minecraft.entity.EntityType;
 import net.minecraft.tags.BlockTags;
-import net.minecraft.util.EnumFacing;
+import net.minecraft.util.Direction;
 import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.EnumLightType;
+import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.world.LightType;
 import net.minecraft.world.World;
 import net.minecraft.world.biome.Biome;
 
 public class SpawnableBlocksHelper {
+    private static final EntityType entityType = EntityType.Builder.create(EntityClassification.MONSTER)
+            .size(0f, 0f).disableSerialization().build(null);
+
     public static void findSpawnableBlocks(Coords coords, int width, int height, BlockProcessor blockProcessor) {
         int blockX = coords.getX();
         int minX = blockX - width;
@@ -32,9 +36,9 @@ public class SpawnableBlocksHelper {
             for (int z = minZ; z < maxZ; z++) {
                 if (isBiomeHostileSpawnProof(world, new BlockPos(x, 1, z))) continue;
 
-                IBlockState upperBlockState = world.getBlockState(new BlockPos(x, minY - 1, z));
+                BlockState upperBlockState = world.getBlockState(new BlockPos(x, minY - 1, z));
                 for (int y = Math.max(1, minY); y < maxY; y++) {
-                    IBlockState spawnBlockState = upperBlockState;
+                    BlockState spawnBlockState = upperBlockState;
                     BlockPos pos = new BlockPos(x, y, z);
                     upperBlockState = world.getBlockState(pos);
                     if (isSpawnable(world, pos, spawnBlockState, upperBlockState)) {
@@ -48,20 +52,18 @@ public class SpawnableBlocksHelper {
     static boolean isBiomeHostileSpawnProof(World world, BlockPos pos) {
         Biome biome = world.getBiome(pos);
         return biome.getSpawningChance() == 0 ||
-                biome.getSpawns(EnumCreatureType.MONSTER).isEmpty();
+                biome.getSpawns(EntityClassification.MONSTER).isEmpty();
     }
 
-    static boolean isSpawnable(World world, BlockPos pos, IBlockState spawnBlockState, IBlockState upperBlockState) {
-        Block spawnBlock = spawnBlockState.getBlock();
-        return spawnBlock != Blocks.AIR &&
-                spawnBlock != Blocks.BEDROCK &&
-                spawnBlock != Blocks.BARRIER &&
-                spawnBlockState.isTopSolid() &&
-                !upperBlockState.isBlockNormalCube() &&
+    static boolean isSpawnable(World world, BlockPos pos, BlockState spawnBlockState, BlockState upperBlockState) {
+        VoxelShape collisionShape = upperBlockState.getCollisionShape(world, pos);
+        boolean isNether = world.dimension.isNether();
+        return spawnBlockState.canEntitySpawn(world, pos.down(), isNether ? EntityType.ZOMBIE_PIGMAN : entityType) &&
+                !Block.doesSideFillSquare(collisionShape, Direction.UP) &&
                 !upperBlockState.canProvidePower() &&
                 !upperBlockState.isIn(BlockTags.RAILS) &&
-                upperBlockState.getCollisionShape(world, pos).getEnd(EnumFacing.Axis.Y) <= 0 &&
+                collisionShape.getEnd(Direction.Axis.Y) <= 0 &&
                 upperBlockState.getFluidState().isEmpty() &&
-                (world.dimension.isNether() || world.getLightFor(EnumLightType.BLOCK, pos) <= 7);
+                (isNether || world.getLightFor(LightType.BLOCK, pos) <= 7);
     }
 }
index f20ef77c02b2e06e2b42474c674025d99c27f534..299d17befeb4c75b0e436e83cee4be3aefce3026 100644 (file)
@@ -3,7 +3,7 @@ package com.irtimaled.bbor.client.interop;
 import com.irtimaled.bbor.client.models.BoundingBoxSpawningSphere;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.Point;
-import net.minecraft.block.state.IBlockState;
+import net.minecraft.block.BlockState;
 import net.minecraft.client.Minecraft;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.World;
@@ -32,9 +32,9 @@ public class SpawningSphereHelper {
 
                 if (SpawnableBlocksHelper.isBiomeHostileSpawnProof(world, new BlockPos(x, 1, z))) continue;
 
-                IBlockState upperBlockState = world.getBlockState(new BlockPos(x, minY - 1, z));
+                BlockState upperBlockState = world.getBlockState(new BlockPos(x, minY - 1, z));
                 for (int y = minY; y < maxY; y++) {
-                    IBlockState spawnBlockState = upperBlockState;
+                    BlockState spawnBlockState = upperBlockState;
                     BlockPos pos = new BlockPos(x, y, z);
                     upperBlockState = world.getBlockState(pos);
                     distance = center.getDistance(new Point(closestX, y, closestZ));
index a43bd50e530926728f6aa3018736fb320ad948d7..52b3f83d4bdb39997ab121df0fa0d5dded57f372 100644 (file)
@@ -35,7 +35,7 @@ public class KeyListener {
         if (windowHandle == mainWindowHandle &&
                 minecraft.currentScreen == null &&
                 keyCode != -1 &&
-                !InputMappings.isKeyDown(292) &&
+                !InputMappings.isKeyDown(mainWindowHandle, 292) &&
                 handleKeyEvent(keyCode, isPressed))
             return;
         minecraft.keyboardListener.onKeyEvent(windowHandle, keyCode, scanCode, action, modifiers);
index c76f6c9a9c6aff98b48ea6df0d368ae7d117397f..ff0c94f5876c741a182405df0c364c979ff99056 100644 (file)
@@ -5,7 +5,7 @@ import com.irtimaled.bbor.client.interop.TileEntitiesHelper;
 import com.irtimaled.bbor.client.models.BoundingBoxBeacon;
 import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.models.Coords;
-import net.minecraft.tileentity.TileEntityBeacon;
+import net.minecraft.tileentity.BeaconTileEntity;
 
 public class BeaconProvider implements IBoundingBoxProvider<BoundingBoxBeacon> {
     @Override
@@ -15,7 +15,7 @@ public class BeaconProvider implements IBoundingBoxProvider<BoundingBoxBeacon> {
 
     @Override
     public Iterable<BoundingBoxBeacon> get(int dimensionId) {
-        return TileEntitiesHelper.map(TileEntityBeacon.class, beacon -> {
+        return TileEntitiesHelper.map(BeaconTileEntity.class, beacon -> {
             int levels = beacon.getLevels();
             Coords coords = new Coords(beacon.getPos());
             return BoundingBoxBeacon.from(coords, levels);
index c74deb3a10586bfeb9b907eaa61ceecb8c3dd765..1890e157f7da7b9ff50e005c16131a1974ecee47 100644 (file)
@@ -6,15 +6,15 @@ import com.irtimaled.bbor.client.interop.TileEntitiesHelper;
 import com.irtimaled.bbor.client.models.BoundingBoxConduit;
 import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.models.Coords;
-import net.minecraft.tileentity.TileEntityConduit;
+import net.minecraft.tileentity.ConduitTileEntity;
 import net.minecraft.util.math.BlockPos;
 
 import java.util.List;
 import java.util.function.Function;
 
 public class ConduitProvider implements IBoundingBoxProvider<BoundingBoxConduit> {
-    private static final Function<TileEntityConduit, List<BlockPos>> blocksFetcher =
-            ReflectionHelper.getPrivateFieldGetter(TileEntityConduit.class, List.class, BlockPos.class);
+    private static final Function<ConduitTileEntity, List<BlockPos>> blocksFetcher =
+            ReflectionHelper.getPrivateFieldGetter(ConduitTileEntity.class, List.class, BlockPos.class);
 
     @Override
     public boolean canProvide(int dimensionId) {
@@ -23,7 +23,7 @@ public class ConduitProvider implements IBoundingBoxProvider<BoundingBoxConduit>
 
     @Override
     public Iterable<BoundingBoxConduit> get(int dimensionId) {
-        return TileEntitiesHelper.map(TileEntityConduit.class, conduit -> {
+        return TileEntitiesHelper.map(ConduitTileEntity.class, conduit -> {
             List<BlockPos> blocks = blocksFetcher.apply(conduit);
             if (blocks == null) return null;
 
index 655b335cf06c8163d82bfde176b2ba5d9121b0e1..2a02712447eb1afdd6f2a3bd91a7f73b214e7fb5 100644 (file)
@@ -5,7 +5,7 @@ import com.irtimaled.bbor.client.interop.TileEntitiesHelper;
 import com.irtimaled.bbor.client.models.BoundingBoxMobSpawner;
 import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.models.Coords;
-import net.minecraft.tileentity.TileEntityMobSpawner;
+import net.minecraft.tileentity.MobSpawnerTileEntity;
 
 public class MobSpawnerProvider implements IBoundingBoxProvider<BoundingBoxMobSpawner> {
     @Override
@@ -15,7 +15,7 @@ public class MobSpawnerProvider implements IBoundingBoxProvider<BoundingBoxMobSp
 
     @Override
     public Iterable<BoundingBoxMobSpawner> get(int dimensionId) {
-        return TileEntitiesHelper.map(TileEntityMobSpawner.class, spawner -> {
+        return TileEntitiesHelper.map(MobSpawnerTileEntity.class, spawner -> {
             Coords coords = new Coords(spawner.getPos());
             return BoundingBoxMobSpawner.from(coords);
         });
index 8d04967688d218550cabfe4b834239d824f09628..d51f623a42667dc05c278d52c735c8a2f63f5d42 100644 (file)
@@ -3,9 +3,9 @@ package com.irtimaled.bbor.client.renderers;
 import com.irtimaled.bbor.client.config.ConfigManager;
 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
 import com.irtimaled.bbor.common.models.Point;
+import com.mojang.blaze3d.platform.GLX;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.renderer.OpenGlHelper;
 import org.lwjgl.opengl.GL11;
 
 import java.awt.*;
@@ -125,7 +125,7 @@ public abstract class AbstractRenderer<T extends AbstractBoundingBox> {
         GL11.glEnable(GL11.GL_TEXTURE_2D);
 
         GL11.glEnable(GL11.GL_BLEND);
-        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_DEPTH_TEST);
         GL11.glEnable(GL11.GL_DEPTH_TEST);
index 8235343c347bff6837d5702b7634c0332976b8ae..9d794fdf49a64c5dc058a3e8177f0eead0c85de7 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor.client.renderers;
 
-import com.irtimaled.bbor.client.Player;
+import com.irtimaled.bbor.client.Camera;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.Point;
 
@@ -20,15 +20,15 @@ class OffsetPoint {
     }
 
     double getX() {
-        return point.getX() - Player.getX();
+        return point.getX() - Camera.getX();
     }
 
     double getY() {
-        return point.getY() - Player.getY();
+        return point.getY() - Camera.getY();
     }
 
     double getZ() {
-        return point.getZ() - Player.getZ();
+        return point.getZ() - Camera.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 65eeffc..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.irtimaled.bbor.client.renderers;
-
-import com.irtimaled.bbor.client.config.ConfigManager;
-import com.irtimaled.bbor.common.models.BoundingBoxVillage;
-import com.irtimaled.bbor.common.models.Coords;
-import com.irtimaled.bbor.common.models.Point;
-import org.lwjgl.opengl.GL11;
-
-import java.awt.*;
-
-public class VillageRenderer extends AbstractRenderer<BoundingBoxVillage> {
-    @Override
-    public void render(BoundingBoxVillage boundingBox) {
-        renderBoundingBoxVillageAsSphere(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.getPoint());
-        OffsetBox bb = new OffsetBox(offsetCenter, offsetCenter)
-                .grow(8, 3, 8);
-
-        renderOutlinedCuboid(bb.nudge(), boundingBox.getColor());
-    }
-
-    private void renderVillageDoors(BoundingBoxVillage boundingBox) {
-        OffsetPoint center = new OffsetPoint(boundingBox.getPoint());
-        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) {
-        Point point = boundingBox.getPoint();
-        double radius = boundingBox.getRadius();
-        Color color = boundingBox.getColor();
-        int density = ConfigManager.villageSphereDensity.get();
-        int dotSize = ConfigManager.villageSphereDotSize.get();
-
-        renderSphere(point, radius, color, density, dotSize);
-    }
-}
index 22a2ae37e8c6ca6bb1ed55e49202f49e72fa8b60..9c1a9b66901db3bd85694df807f08643bea92ba8 100644 (file)
@@ -33,7 +33,6 @@ public class BoundingBoxType {
     public static final BoundingBoxType Igloo = register("Igloo");
     public static final BoundingBoxType PillagerOutpost = register("Pillager_Outpost");
     public static final BoundingBoxType Village = register("Village");
-    public static final BoundingBoxType VillageSpheres = register("Village Sphere");
     public static final BoundingBoxType NetherFossil = register("Nether_Fossil");
     public static final BoundingBoxType BastionRemnant = register("Bastion_Remnant");
     public static final BoundingBoxType RuinedPortal = register("Ruined_Portal");
index c9add51fcc50bd192fea446d7be75974e15c8c1b..b39613757230eceebc55cb616c8ef59baf9d9931 100644 (file)
@@ -5,7 +5,6 @@ import com.irtimaled.bbor.common.events.*;
 import com.irtimaled.bbor.common.messages.AddBoundingBox;
 import com.irtimaled.bbor.common.messages.InitializeClient;
 import com.irtimaled.bbor.common.messages.PayloadBuilder;
-import com.irtimaled.bbor.common.messages.RemoveBoundingBox;
 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
 import com.irtimaled.bbor.common.models.ServerPlayer;
 
@@ -18,7 +17,6 @@ import java.util.concurrent.ConcurrentHashMap;
 public class CommonProxy {
     private final Map<Integer, ServerPlayer> players = new ConcurrentHashMap<>();
     private final Map<Integer, Set<AbstractBoundingBox>> playerBoundingBoxesCache = new HashMap<>();
-    private final Map<Integer, VillageProcessor> villageProcessors = new HashMap<>();
     private final Map<Integer, StructureProcessor> structureProcessors = new HashMap<>();
     private final Map<Integer, BoundingBoxCache> dimensionCache = new ConcurrentHashMap<>();
     private Long seed = null;
@@ -32,9 +30,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) {
@@ -85,27 +81,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;
-
-        for (Map.Entry<Integer, ServerPlayer> playerEntry : players.entrySet()) {
-            int playerId = playerEntry.getKey();
-            ServerPlayer player = playerEntry.getValue();
-            if (player.getDimensionId() == dimensionId) {
-                player.sendPacket(payload);
-
-                if (playerBoundingBoxesCache.containsKey(playerId)) {
-                    playerBoundingBoxesCache.get(playerId).remove(boundingBox);
-                }
-            }
-        }
-    }
-
     private void onPlayerSubscribed(PlayerSubscribed event) {
         int playerId = event.getPlayerId();
         ServerPlayer player = event.getPlayer();
@@ -137,13 +112,6 @@ public class CommonProxy {
         }
     }
 
-    protected void removeBoundingBox(int dimensionId, AbstractBoundingBox key) {
-        BoundingBoxCache cache = getCache(dimensionId);
-        if (cache == null) return;
-
-        cache.removeBoundingBox(key);
-    }
-
     private void serverTick() {
         for (Map.Entry<Integer, ServerPlayer> playerEntry : players.entrySet()) {
             int playerId = playerEntry.getKey();
@@ -153,17 +121,6 @@ public class CommonProxy {
         }
     }
 
-    private void serverWorldTick(ServerWorldTick event) {
-        int dimensionId = event.getDimensionId();
-        VillageProcessor villageProcessor = villageProcessors.get(dimensionId);
-        if (villageProcessor == null) {
-            villageProcessor = new VillageProcessor(dimensionId, getOrCreateCache(dimensionId));
-            villageProcessors.put(dimensionId, villageProcessor);
-        }
-
-        villageProcessor.process(event.getWorld());
-    }
-
     protected BoundingBoxCache getCache(int dimensionId) {
         return dimensionCache.get(dimensionId);
     }
@@ -173,10 +130,6 @@ public class CommonProxy {
     }
 
     protected void clearCaches() {
-        for (VillageProcessor villageProcessor : villageProcessors.values()) {
-            villageProcessor.clear();
-        }
-        villageProcessors.clear();
         structureProcessors.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 4448f5c..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 final 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 ac6b019..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 final 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();
-    }
-}
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 3116143..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 final 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 0dbfb795cba21370d1b9520f6909a6333fdfd23f..1d343e9d3c3fbba26a46b7d3a2e7e3d2f6a3b7ea 100644 (file)
@@ -3,10 +3,10 @@ package com.irtimaled.bbor.common.interop;
 import com.irtimaled.bbor.common.EventBus;
 import com.irtimaled.bbor.common.events.*;
 import com.irtimaled.bbor.common.models.ServerPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.network.NetHandlerPlayServer;
+import net.minecraft.entity.player.ServerPlayerEntity;
 import net.minecraft.network.NetworkManager;
-import net.minecraft.world.WorldServer;
+import net.minecraft.network.play.ServerPlayNetHandler;
+import net.minecraft.world.ServerWorld;
 import net.minecraft.world.chunk.Chunk;
 import net.minecraft.world.gen.feature.structure.StructureStart;
 
@@ -20,13 +20,13 @@ public class CommonInterop {
         if(structures.size() > 0) EventBus.publish(new StructuresLoaded(structures, dimensionId));
     }
 
-    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));
     }
 
@@ -34,12 +34,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;
@@ -48,11 +44,11 @@ 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)));
     }
 }
index c25a9b95a365abd8117f7ba6174dad38125a397e..e6930c373817e262082cfd1a12fd12fae81cd3de 100644 (file)
@@ -3,25 +3,14 @@ package com.irtimaled.bbor.common.messages;
 import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
 import com.irtimaled.bbor.common.models.BoundingBoxCuboid;
-import com.irtimaled.bbor.common.models.BoundingBoxVillage;
 import com.irtimaled.bbor.common.models.Coords;
 
-import java.awt.*;
-import java.util.HashSet;
-import java.util.Set;
-
 class BoundingBoxDeserializer {
     static AbstractBoundingBox deserialize(PayloadReader reader) {
         if (!reader.isReadable(2)) return null;
 
         char type = reader.readChar();
-        switch (type) {
-            case 'V':
-                return deserializeVillage(reader);
-            case 'S':
-                return deserializeStructure(reader);
-        }
-        return null;
+        return type == 'S' ? deserializeStructure(reader) : null;
     }
 
     private static AbstractBoundingBox deserializeStructure(PayloadReader reader) {
@@ -31,16 +20,4 @@ class BoundingBoxDeserializer {
         Coords maxCoords = reader.readCoords();
         return BoundingBoxCuboid.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);
-    }
 }
index d4c41d1bd8c9869a4bb31c59a395ad2d2051d82e..f8498381f10765fa0ca1a6cc75c5638ef6c91abe 100644 (file)
@@ -2,8 +2,6 @@ package com.irtimaled.bbor.common.messages;
 
 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
 import com.irtimaled.bbor.common.models.BoundingBoxCuboid;
-import com.irtimaled.bbor.common.models.BoundingBoxVillage;
-import com.irtimaled.bbor.common.models.Coords;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -13,7 +11,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(BoundingBoxCuboid.class, (bb, pb) -> serializeStructure((BoundingBoxCuboid)bb, pb));
     }
 
@@ -28,17 +25,6 @@ class BoundingBoxSerializer {
         serializer.accept(boundingBox, builder);
     }
 
-    private static void serializeVillage(BoundingBoxVillage boundingBox, PayloadBuilder builder) {
-        builder.writeChar('V')
-                .writeCoords(boundingBox.getCenter())
-                .writeVarInt((int)boundingBox.getRadius())
-                .writeBoolean(boundingBox.getSpawnsIronGolems())
-                .writeVarInt(boundingBox.getColor().getRGB());
-        for (Coords door : boundingBox.getDoors()) {
-            builder.writeCoords(door);
-        }
-    }
-
     private static void serializeStructure(BoundingBoxCuboid boundingBox, PayloadBuilder builder) {
         builder.writeChar('S')
                 .writeInt(boundingBox.getType().hashCode())
index d40cc235d8ee2d7285b26e7d8e24556a2c3b9910..173dfbef5e9728eae89c3c94c50828ffc11a5f0e 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 final 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;
@@ -65,12 +65,6 @@ public class PayloadBuilder {
         return this;
     }
 
-    PayloadBuilder writeBoolean(boolean value) {
-        buffer.writeBoolean(value);
-        packet = null;
-        return this;
-    }
-
     PayloadBuilder writeCoords(Coords coords) {
         return writeVarInt(coords.getX())
                 .writeVarInt(coords.getY())
index 4db5bb46b7692933adda1f0042985950a62fe2b2..03b3775c991b17fc2dbeb9b400b00dbc993ad7ea 100644 (file)
@@ -34,10 +34,6 @@ public class PayloadReader {
         return buffer.readChar();
     }
 
-    boolean readBoolean() {
-        return buffer.readBoolean();
-    }
-
     Coords readCoords() {
         int x = readVarInt();
         int y = readVarInt();
diff --git a/src/main/java/com/irtimaled/bbor/common/messages/RemoveBoundingBox.java b/src/main/java/com/irtimaled/bbor/common/messages/RemoveBoundingBox.java
deleted file mode 100644 (file)
index 2baf62e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.irtimaled.bbor.common.messages;
-
-import com.irtimaled.bbor.client.events.RemoveBoundingBoxReceived;
-import com.irtimaled.bbor.common.models.AbstractBoundingBox;
-
-public class RemoveBoundingBox {
-    public static final String NAME = "bbor:remove_bounding_box";
-
-    public static PayloadBuilder getPayload(int dimensionId, AbstractBoundingBox key) {
-        if (!BoundingBoxSerializer.canSerialize(key)) return null;
-
-        PayloadBuilder builder = PayloadBuilder.clientBound(NAME)
-                .writeVarInt(dimensionId);
-        BoundingBoxSerializer.serialize(key, builder);
-        return builder;
-    }
-
-    public static RemoveBoundingBoxReceived getEvent(PayloadReader reader) {
-        int dimensionId = reader.readVarInt();
-        AbstractBoundingBox key = BoundingBoxDeserializer.deserialize(reader);
-        if (key == null) return null;
-
-        return new RemoveBoundingBoxReceived(dimensionId, key);
-    }
-}
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 c2d2180..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.irtimaled.bbor.common.models;
-
-import com.irtimaled.bbor.common.BoundingBoxType;
-import com.irtimaled.bbor.common.TypeHelper;
-import com.irtimaled.bbor.common.VillageColorCache;
-import com.irtimaled.bbor.common.VillageHelper;
-
-import java.awt.*;
-import java.util.Set;
-
-public class BoundingBoxVillage extends BoundingBoxSphere {
-    private final boolean spawnsIronGolems;
-    private final Color color;
-    private final Coords center;
-    private final Set<Coords> doors;
-    private final int villageHash;
-
-    private BoundingBoxVillage(Point point, Integer radius, Color color, boolean spawnsIronGolems, Set<Coords> doors) {
-        super(point, radius, BoundingBoxType.VillageSpheres);
-        this.center = point.getCoords();
-        this.color = color;
-        this.spawnsIronGolems = spawnsIronGolems;
-        this.doors = doors;
-        this.villageHash = VillageHelper.computeHash(this.center, radius, spawnsIronGolems, doors);
-    }
-
-    public static BoundingBoxVillage from(Coords center, Integer radius, Color color, boolean spawnsIronGolems, Set<Coords> doors) {
-        Point point = calculateCenterPoint(center, doors);
-        return new BoundingBoxVillage(point, radius, color, spawnsIronGolems, doors);
-    }
-
-    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 static Point calculateCenterPoint(Coords center, 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;
-        }
-
-        double x = Math.abs(maxX - minX) % 2 == 0 ? 0.5 : (minX < 0 ? 0 : 1);
-        double z = Math.abs(maxZ - minZ) % 2 == 0 ? 0.5 : (minZ < 0 ? 0 : 1);
-        return new Point(center).offset(x, 0.0D, z);
-    }
-
-    public Color getColor() {
-        return color;
-    }
-
-    @Override
-    public int hashCode() {
-        return TypeHelper.combineHashCodes(super.hashCode(), villageHash);
-    }
-
-    public boolean getSpawnsIronGolems() {
-        return spawnsIronGolems;
-    }
-
-    public Set<Coords> getDoors() {
-        return doors;
-    }
-
-    public int getVillageHash() {
-        return villageHash;
-    }
-
-    public Coords getCenter() {
-        return center;
-    }
-}
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 3993efab4959d2fc4a0a256cc515352e93223ed5..881e8b989cb4232b8ee73b3cc10a0a7d7a08c8d9 100644 (file)
@@ -35,7 +35,6 @@ public abstract class Tweaker implements ITweaker {
         MixinBootstrap.init();
         Mixins.addConfiguration("mixins.bbor.json");
         MixinEnvironment.getDefaultEnvironment().setSide(isClient() ? MixinEnvironment.Side.CLIENT : MixinEnvironment.Side.SERVER);
-
     }
 
     protected abstract boolean isClient();
index 5b500cda556ed5024081431a7f890636c6051673..68e23bdc8e7718ab21e4abc7bb480ddd5d460ef0 100644 (file)
@@ -2,9 +2,9 @@ package com.irtimaled.bbor.mixin.client;
 
 import com.irtimaled.bbor.client.ClientProxy;
 import com.irtimaled.bbor.client.interop.ModPackFinder;
+import net.minecraft.client.GameConfiguration;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.main.GameConfiguration;
-import net.minecraft.client.resources.ResourcePackInfoClient;
+import net.minecraft.client.resources.ClientResourcePackInfo;
 import net.minecraft.resources.ResourcePackList;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
@@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(Minecraft.class)
 public class MixinMinecraft {
-    @Shadow @Final private ResourcePackList<ResourcePackInfoClient> resourcePackRepository;
+    @Shadow @Final private ResourcePackList<ClientResourcePackInfo> resourcePackRepository;
     private ClientProxy clientProxy;
 
     @Inject(method = "<init>", at = @At("RETURN"))
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 2cfd6fdc35778fdc28d0ef7e5a04244cf5838cc6..2b11c83443228f92e7f235fc15d47aba86df1bd8 100644 (file)
@@ -2,15 +2,15 @@ package com.irtimaled.bbor.mixin.client.gui;
 
 import com.irtimaled.bbor.client.gui.ListScreen;
 import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.GuiChat;
+import net.minecraft.client.gui.screen.ChatScreen;
 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;
 
-@Mixin(GuiChat.class)
+@Mixin(ChatScreen.class)
 public class MixinGuiChat {
-    @Inject(method = "keyPressed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/GuiScreen;)V", shift = At.Shift.BEFORE), cancellable = true)
+    @Inject(method = "keyPressed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;displayGuiScreen(Lnet/minecraft/client/gui/screen/Screen;)V", shift = At.Shift.BEFORE), cancellable = true)
     private void keyPressed(CallbackInfoReturnable<Boolean> cir) {
         if (Minecraft.getInstance().currentScreen instanceof ListScreen) {
             cir.setReturnValue(true);
index f72c54f7dee3d4935411bfeb132df207d6fd7c32..121b5540c57903ce148b579484c542c59f3a80d2 100644 (file)
@@ -1,22 +1,27 @@
 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;
         }
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 e1a66bc032844fec7a4d1a42e8806d1021412f78..094bc76231c8365a93eea0b743013985eff37432 100644 (file)
@@ -1,14 +1,14 @@
 package com.irtimaled.bbor.mixin.client.network;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.network.NetHandlerPlayClient;
-import net.minecraft.network.play.server.SPacketChunkData;
+import net.minecraft.client.network.play.ClientPlayNetHandler;
+import net.minecraft.network.play.server.SChunkDataPacket;
 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) {
@@ -16,7 +16,7 @@ public class MixinNetHandlerPlayClient {
     }
 
     @Inject(method="handleChunkData", at = @At("RETURN"))
-    private void onChunkData(SPacketChunkData packet, CallbackInfo ci) {
+    private void onChunkData(SChunkDataPacket packet, CallbackInfo ci) {
         ClientInterop.receivedChunk(packet.getChunkX(), packet.getChunkZ());
     }
 }
index ac93d6659fb271832021df39c8321fdb9d4da515..f7ab46811dea73060b6e5f01d77cd83b741a7a3b 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;endStartSection(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 463d4c9ad115881eacb21359098c77ba5c8af186..a69e3d6b1198f34d354304d6c90f3a72e23abb20 100644 (file)
@@ -6,7 +6,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;
@@ -16,16 +18,19 @@ 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) {
         ClientProxy.registerKeyBindings();
         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 b50017af659c6662bcdc006073f9f73a09d9ff88..6307170e22643bbb4805efd642a6c633137f477e 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.SPacketChat;
+import net.minecraft.network.play.server.SChatPacket;
 import net.minecraft.util.text.ITextComponent;
 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(SPacketChat.class)
+@Mixin(SChatPacket.class)
 public class MixinSPacketChat {
     @Shadow private ITextComponent chatComponent;
 
index 30647e2901d080861c793dd28639bd7330cd9c57..16505e392c2be97ef2fc9d1b655a60f6f572ec37 100644 (file)
@@ -2,19 +2,19 @@ package com.irtimaled.bbor.mixin.network.play.server;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
 import com.irtimaled.bbor.common.TypeHelper;
-import net.minecraft.client.network.NetHandlerPlayClient;
-import net.minecraft.network.play.INetHandlerPlayClient;
-import net.minecraft.network.play.server.SPacketCommandList;
+import net.minecraft.client.network.play.ClientPlayNetHandler;
+import net.minecraft.client.network.play.IClientPlayNetHandler;
+import net.minecraft.network.play.server.SCommandListPacket;
 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(SPacketCommandList.class)
+@Mixin(SCommandListPacket.class)
 public class MixinSPacketCommandList {
     @Inject(method = "processPacket", at= @At("RETURN"))
-    private void processPacket(INetHandlerPlayClient netHandlerPlayClient, CallbackInfo ci) {
-        TypeHelper.doIfType(netHandlerPlayClient, NetHandlerPlayClient.class, handler ->
+    private void processPacket(IClientPlayNetHandler netHandlerPlayClient, CallbackInfo ci) {
+        TypeHelper.doIfType(netHandlerPlayClient, ClientPlayNetHandler.class, handler ->
                 ClientInterop.registerClientCommands(handler.func_195515_i()));
     }
 }
index a0ab1d64f72fd388222a030d9a4465a75a2b5982..1586bec4fb10a99a259e90491eb0dbbdb83510e9 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,17 +28,13 @@ 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: {
                         EventBus.publish(AddBoundingBox.getEvent(reader));
                         break;
                     }
-                    case RemoveBoundingBox.NAME: {
-                        EventBus.publish(RemoveBoundingBox.getEvent(reader));
-                        break;
-                    }
                 }
             } finally {
                 if (data != null)
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 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 4ae6f48a9d09391f8b793d930772f663831274b8..5924988c34c5a94f3094df3709b4ce7a624e5a29 100644 (file)
@@ -29,6 +29,7 @@ public class ServerRunner {
     private static final ThrowableConsumer<URL> addURL;
 
     static {
+        VANILLA_SERVER_JARS.put("1.14.2", "https://launcher.mojang.com/v1/objects/808be3869e2ca6b62378f9f4b33c946621620019/server.jar");
         VANILLA_SERVER_JARS.put("1.13.2", "https://launcher.mojang.com/v1/objects/3737db93722a9e39eeada7c27e7aca28b144ffa7/server.jar");
 
         try {
index ca84b7cf55281c34b0be534f66adcd4d247c41c6..a58ad2f856e487b81702653967c93fcfa29d30d4 100644 (file)
@@ -9,7 +9,6 @@
     "network.play.client.MixinCPacketCustomPayload",
     "server.MixinMinecraftServer",
     "server.management.MixinPlayerList",
-    "world.MixinWorldServer",
     "world.chunk.MixinChunk"
   ],
   "client": [