]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Setup for 1.14.4-Fabric
authorIrtimaled <irtimaled@gmail.com>
Tue, 6 Aug 2019 05:16:12 +0000 (22:16 -0700)
committerIrtimaled <irtimaled@gmail.com>
Mon, 5 Oct 2020 05:51:17 +0000 (22:51 -0700)
92 files changed:
build.gradle
gradle/wrapper/gradle-wrapper.properties
gradlew
src/main/java/com/irtimaled/bbor/Main.java [deleted file]
src/main/java/com/irtimaled/bbor/client/Camera.java
src/main/java/com/irtimaled/bbor/client/Player.java
src/main/java/com/irtimaled/bbor/client/commands/Arguments.java
src/main/java/com/irtimaled/bbor/client/commands/BeaconCommandBuilder.java
src/main/java/com/irtimaled/bbor/client/commands/BoxCommandBuilder.java
src/main/java/com/irtimaled/bbor/client/commands/CommandHelper.java
src/main/java/com/irtimaled/bbor/client/commands/ConfigCommand.java
src/main/java/com/irtimaled/bbor/client/commands/CustomCommand.java
src/main/java/com/irtimaled/bbor/client/commands/LineCommandBuilder.java
src/main/java/com/irtimaled/bbor/client/commands/SeedCommand.java
src/main/java/com/irtimaled/bbor/client/commands/SpawningSphereCommand.java
src/main/java/com/irtimaled/bbor/client/commands/SphereCommandBuilder.java
src/main/java/com/irtimaled/bbor/client/commands/StructuresCommand.java
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/ControlList.java
src/main/java/com/irtimaled/bbor/client/gui/ControlListSection.java
src/main/java/com/irtimaled/bbor/client/gui/IControl.java
src/main/java/com/irtimaled/bbor/client/gui/IControlSet.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/MaxYSettingSlider.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/WorldSaveRow.java
src/main/java/com/irtimaled/bbor/client/interop/BedrockCeilingHelper.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/FlowerForestHelper.java
src/main/java/com/irtimaled/bbor/client/interop/ModPackFinder.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/interop/TileEntitiesHelper.java
src/main/java/com/irtimaled/bbor/client/keyboard/CustomKeyBinding.java
src/main/java/com/irtimaled/bbor/client/keyboard/Key.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/FlowerForestProvider.java
src/main/java/com/irtimaled/bbor/client/providers/MobSpawnerProvider.java
src/main/java/com/irtimaled/bbor/client/providers/SlimeChunkProvider.java
src/main/java/com/irtimaled/bbor/client/providers/SpawnableBlocksProvider.java
src/main/java/com/irtimaled/bbor/client/providers/SpawningSphereProvider.java
src/main/java/com/irtimaled/bbor/client/renderers/AbstractRenderer.java
src/main/java/com/irtimaled/bbor/client/renderers/RenderHelper.java
src/main/java/com/irtimaled/bbor/client/renderers/Renderer.java
src/main/java/com/irtimaled/bbor/client/renderers/SpawningSphereRenderer.java
src/main/java/com/irtimaled/bbor/common/StructureProcessor.java
src/main/java/com/irtimaled/bbor/common/events/StructuresLoaded.java
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/AddBoundingBox.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/models/DimensionId.java
src/main/java/com/irtimaled/bbor/common/models/ServerPlayer.java
src/main/java/com/irtimaled/bbor/install/Installer.java [deleted file]
src/main/java/com/irtimaled/bbor/launch/ClientTweaker.java [deleted file]
src/main/java/com/irtimaled/bbor/launch/ServerTweaker.java [deleted file]
src/main/java/com/irtimaled/bbor/launch/Tweaker.java [deleted file]
src/main/java/com/irtimaled/bbor/mixin/client/MixinGameSettings.java
src/main/java/com/irtimaled/bbor/mixin/client/MixinMinecraft.java
src/main/java/com/irtimaled/bbor/mixin/client/entity/player/MixinClientPlayerEntity.java
src/main/java/com/irtimaled/bbor/mixin/client/gui/screen/MixinChatScreen.java
src/main/java/com/irtimaled/bbor/mixin/client/gui/screen/MixinOptionsScreen.java
src/main/java/com/irtimaled/bbor/mixin/client/network/login/MixinClientLoginNetHandler.java
src/main/java/com/irtimaled/bbor/mixin/client/network/play/MixinClientPlayNetHandler.java
src/main/java/com/irtimaled/bbor/mixin/client/renderer/MixinGameRenderer.java
src/main/java/com/irtimaled/bbor/mixin/client/settings/MixinKeyBinding.java
src/main/java/com/irtimaled/bbor/mixin/client/world/MixinClientWorld.java
src/main/java/com/irtimaled/bbor/mixin/network/play/client/MixinCCustomPayloadPacket.java
src/main/java/com/irtimaled/bbor/mixin/network/play/server/MixinSChatPacket.java
src/main/java/com/irtimaled/bbor/mixin/network/play/server/MixinSChunkDataPacket.java
src/main/java/com/irtimaled/bbor/mixin/network/play/server/MixinSCommandListPacket.java
src/main/java/com/irtimaled/bbor/mixin/network/play/server/MixinSCustomPayloadPlayPacket.java
src/main/java/com/irtimaled/bbor/mixin/network/play/server/MixinSSpawnPositionPacket.java
src/main/java/com/irtimaled/bbor/mixin/server/MixinMinecraftServer.java
src/main/java/com/irtimaled/bbor/mixin/server/dedicated/MixinDedicatedServer.java
src/main/java/com/irtimaled/bbor/mixin/server/management/MixinPlayerList.java
src/main/java/com/irtimaled/bbor/mixin/world/chunk/MixinChunk.java
src/main/java/com/irtimaled/bbor/server/ServerRunner.java [deleted file]
src/main/java/com/irtimaled/bbor/server/ThrowableConsumer.java [deleted file]
src/main/resources/fabric.mod.json [new file with mode: 0644]
src/main/resources/profile.json [deleted file]

index 712bd6bc050966dea14fcb5afc762f055e30db24..0b9a65110a8cdaf1fddf8ec2c71d0f0b349dd5e5 100644 (file)
@@ -1,19 +1,19 @@
 buildscript {
     repositories {
         jcenter()
-        maven { url 'https://repo.spongepowered.org/maven' }
-        maven { url 'https://jitpack.io' }
-        maven { url 'https://files.minecraftforge.net/maven' }
+        maven {
+            name = 'Fabric'
+            url = 'https://maven.fabricmc.net/'
+        }
     }
     dependencies {
-        classpath 'com.github.Irtimaled:ForgeGradle:2.6-SNAPSHOT'
-        classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
+        classpath "net.fabricmc:fabric-loom:0.2.7-SNAPSHOT"
     }
 }
 
-apply plugin: 'net.minecraftforge.gradle.tweaker-client'
+apply plugin: 'fabric-loom'
 apply plugin: 'java'
-apply plugin: 'org.spongepowered.mixin'
+apply plugin: 'idea'
 
 group 'com.irtimaled'
 version project.buildVersion + '-' + project.mcVersion
@@ -22,58 +22,23 @@ archivesBaseName = 'BBOutlineReloaded'
 sourceCompatibility = 1.8
 targetCompatibility = 1.8
 
-repositories {
-    mavenCentral()
-    maven { url 'https://libraries.minecraft.net/' }
-    maven { url 'https://repo.spongepowered.org/maven/' }
-    maven { url 'https://jitpack.io' }
-}
-
 dependencies {
-    implementation('org.spongepowered:mixin:0.8') { transitive = false }
-    implementation('net.minecraft:launchwrapper:1.12') { transitive = false }
-    implementation 'org.ow2.asm:asm-tree:6.2'
-    implementation 'org.ow2.asm:asm-commons:6.2'
-    implementation "org.ow2.asm:asm-util:6.2"
+    minecraft 'com.mojang:minecraft:' + project.mcVersion
+    mappings 'net.fabricmc:yarn:' + project.mcVersion + '+build.16'
+    modCompile 'net.fabricmc:fabric-loader:0.8.3+build.196'
 }
 
 minecraft {
-    version = project.mcVersion
-    mappings = 'snapshot_20200119'
-    runDir = 'run'
-    tweakClass = 'com.irtimaled.bbor.launch.ClientTweaker'
-    makeObfSourceJar = false
-    clientJvmArgs = ['-XstartOnFirstThread']
-}
-
-mixin {
-    defaultObfuscationEnv notch
-    add sourceSets.main, 'mixins.bbor.refmap.json'
-}
-
-sourceSets {
-    main
-    debug {
-        compileClasspath += main.compileClasspath
-    }
+    refmapName = 'mixins.bbor.refmap.json'
 }
 
 processResources {
-    filesMatching('profile.json') {
-        expand([
-                'version'      : project.version,
-                'mcVersion'    : project.mcVersion,
-                'tweakClass'   : project.minecraft.tweakClass,
-                'formattedTime': new Date().format("yyyy-MM-dd'T'HH:mm:ss'-08:00'")
-        ])
+    filesMatching('fabric.mod.json') {
+        expand version: project.version
     }
-
-    inputs.property "version", project.version
-    inputs.property "mcVersion", project.mcVersion
 }
 
 jar {
-    finalizedBy reobfJar
     manifest {
         attributes([
                 "Main-Class": "com.irtimaled.bbor.Main",
@@ -86,10 +51,8 @@ jar {
                 "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
         ])
     }
-
-    classifier = 'vanilla'
 }
 
-artifacts {
-    archives jar
+afterEvaluate {
+    remapJar.classifier = 'fabric'
 }
index f2fe5ed4f45c18bc391a23e32c2ae28f8e8fc483..f78ba29908cbdb5ae7ed6d6d4c2119c035fd4d1f 100644 (file)
@@ -1,5 +1,5 @@
-#Sun May 24 16:37:33 PDT 2020
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
+#Tue May 26 09:16:06 PDT 2020
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index cccdd3d517fc5249beaefa600691cf150f2fa3e6..a2fe5d5964dfda14f55ebf5cae87dab84a7973df 100755 (executable)
--- a/gradlew
+++ b/gradlew
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
 
 ##############################################################################
 ##
@@ -154,19 +154,16 @@ if $cygwin ; then
     esac
 fi
 
-# Escape application args
-save () {
-    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
-    echo " "
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+    JVM_OPTS=("$@")
 }
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
 
 # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
   cd "$(dirname "$0")"
 fi
 
-exec "$JAVACMD" "$@"
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/src/main/java/com/irtimaled/bbor/Main.java b/src/main/java/com/irtimaled/bbor/Main.java
deleted file mode 100644 (file)
index c9e09a3..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.irtimaled.bbor;
-
-import com.irtimaled.bbor.install.Installer;
-import com.irtimaled.bbor.server.ServerRunner;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-public class Main {
-    public static void main(String... args) throws IOException {
-        if (args.length > 0 && args[0].equals("--server")) {
-            ServerRunner.run(Arrays.asList(args).subList(1, args.length));
-        } else {
-            Installer.install();
-        }
-    }
-}
index 78ac43922f41153970fa15aec7ffb44636150572..fefec572348a805e8070cb976ee93bc67841d4c8 100644 (file)
@@ -1,11 +1,11 @@
 package com.irtimaled.bbor.client;
 
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 import net.minecraft.util.math.Vec3d;
 
 public class Camera {
     private static Vec3d getPos() {
-        return Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
+        return MinecraftClient.getInstance().gameRenderer.getCamera().getPos();
     }
 
     public static double getX() {
index 4b36029b961ebd8fb6140893656c394954870910..f6db9a23d4db78c10396627273bd313c82599ed7 100644 (file)
@@ -3,7 +3,7 @@ package com.irtimaled.bbor.client;
 import com.irtimaled.bbor.client.models.Point;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.client.entity.player.ClientPlayerEntity;
+import net.minecraft.client.network.ClientPlayerEntity;
 
 public class Player {
     private static double x;
@@ -13,9 +13,9 @@ public class Player {
     private static DimensionId dimensionId;
 
     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;
+        x = player.prevX + (player.x - player.prevX) * partialTicks;
+        y = player.prevY + (player.y - player.prevY) * partialTicks;
+        z = player.prevZ + (player.z - player.prevZ) * partialTicks;
         dimensionId = DimensionId.from(player.dimension);
     }
 
index a0f0dc5f94751a16f632d17c49e185f4fea29f1c..a130504d885f20965b472551688a40cbe9fce353 100644 (file)
@@ -6,19 +6,19 @@ import com.irtimaled.bbor.common.models.Coords;
 import com.mojang.brigadier.arguments.*;
 import com.mojang.brigadier.context.CommandContext;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.arguments.BlockPosArgument;
-import net.minecraft.command.arguments.Vec3Argument;
+import net.minecraft.command.arguments.BlockPosArgumentType;
+import net.minecraft.command.arguments.Vec3ArgumentType;
+import net.minecraft.server.command.ServerCommandSource;
 
 import java.util.function.Supplier;
 
 public class Arguments {
-    public static BlockPosArgument coords() {
-        return BlockPosArgument.blockPos();
+    public static BlockPosArgumentType coords() {
+        return BlockPosArgumentType.blockPos();
     }
 
-    public static Vec3Argument point() {
-        return Vec3Argument.vec3();
+    public static Vec3ArgumentType point() {
+        return Vec3ArgumentType.vec3();
     }
 
     public static IntegerArgumentType integer() {
@@ -45,31 +45,31 @@ public class Arguments {
         return new HexColorArgument();
     }
 
-    public static Coords getCoords(CommandContext<CommandSource> context, String name) throws CommandSyntaxException {
-        return new Coords(getArgumentValueOrDefault(context, name, Vec3Argument::getVec3, () -> context.getSource().getPos()));
+    public static Coords getCoords(CommandContext<ServerCommandSource> context, String name) throws CommandSyntaxException {
+        return new Coords(getArgumentValueOrDefault(context, name, Vec3ArgumentType::getVec3, () -> context.getSource().getPosition()));
     }
 
-    public static Point getPoint(CommandContext<CommandSource> context, String name) throws CommandSyntaxException {
-        return new Point(getArgumentValueOrDefault(context, name, Vec3Argument::getVec3, () -> context.getSource().getPos()));
+    public static Point getPoint(CommandContext<ServerCommandSource> context, String name) throws CommandSyntaxException {
+        return new Point(getArgumentValueOrDefault(context, name, Vec3ArgumentType::getVec3, () -> context.getSource().getPosition()));
     }
 
-    public static int getInteger(CommandContext<CommandSource> context, String name) throws CommandSyntaxException {
+    public static int getInteger(CommandContext<ServerCommandSource> context, String name) throws CommandSyntaxException {
         return getArgumentValueOrDefault(context, name, IntegerArgumentType::getInteger, () -> 0);
     }
 
-    public static double getDouble(CommandContext<CommandSource> context, String name) throws CommandSyntaxException {
+    public static double getDouble(CommandContext<ServerCommandSource> context, String name) throws CommandSyntaxException {
         return getArgumentValueOrDefault(context, name, DoubleArgumentType::getDouble, () -> 0.0D);
     }
 
-    public static String getString(CommandContext<CommandSource> context, String name) throws CommandSyntaxException {
+    public static String getString(CommandContext<ServerCommandSource> context, String name) throws CommandSyntaxException {
         return getArgumentValueOrDefault(context, name, StringArgumentType::getString, () -> "");
     }
 
-    public static boolean getBool(CommandContext<CommandSource> context, String name) throws CommandSyntaxException {
+    public static boolean getBool(CommandContext<ServerCommandSource> context, String name) throws CommandSyntaxException {
         return getArgumentValueOrDefault(context, name, BoolArgumentType::getBool, () -> false);
     }
 
-    private static <T> T getArgumentValueOrDefault(CommandContext<CommandSource> context,
+    private static <T> T getArgumentValueOrDefault(CommandContext<ServerCommandSource> context,
                                                    String name,
                                                    ArgumentFetcher<T> getValue,
                                                    Supplier<T> defaultValue) throws CommandSyntaxException {
@@ -82,6 +82,6 @@ public class Arguments {
 
     @FunctionalInterface
     private interface ArgumentFetcher<T> {
-        T get(CommandContext<CommandSource> context, String name) throws CommandSyntaxException;
+        T get(CommandContext<ServerCommandSource> context, String name) throws CommandSyntaxException;
     }
 }
index fa3b55b94e3f27191152a2de15e1a211a3d2c53c..00818b2f19e6f40c8ed505b980a85df5c374d154 100644 (file)
@@ -5,28 +5,28 @@ import com.irtimaled.bbor.common.models.Coords;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
 import com.mojang.brigadier.context.CommandContext;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.Commands;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.ServerCommandSource;
 
 class BeaconCommandBuilder {
     private static final String LEVEL = "level";
 
-    static LiteralArgumentBuilder<CommandSource> build(String command) {
-        return Commands.literal(command)
-                .then(Commands.literal(ArgumentNames.ADD)
-                        .then(Commands.argument(ArgumentNames.POS, Arguments.coords())
-                                .then(Commands.argument(LEVEL, Arguments.integer(1, 4))
+    static LiteralArgumentBuilder<ServerCommandSource> build(String command) {
+        return CommandManager.literal(command)
+                .then(CommandManager.literal(ArgumentNames.ADD)
+                        .then(CommandManager.argument(ArgumentNames.POS, Arguments.coords())
+                                .then(CommandManager.argument(LEVEL, Arguments.integer(1, 4))
                                         .executes(BeaconCommandBuilder::addBeacon)))
-                        .then(Commands.argument(LEVEL, Arguments.integer(1, 4))
+                        .then(CommandManager.argument(LEVEL, Arguments.integer(1, 4))
                                 .executes(BeaconCommandBuilder::addBeacon)))
-                .then(Commands.literal(ArgumentNames.CLEAR)
+                .then(CommandManager.literal(ArgumentNames.CLEAR)
                         .executes(context -> {
                             CustomBeaconProvider.clear();
 
                             CommandHelper.feedback(context, "bbor.commands.beacon.cleared.all");
                             return 0;
                         })
-                        .then(Commands.argument(ArgumentNames.POS, Arguments.coords())
+                        .then(CommandManager.argument(ArgumentNames.POS, Arguments.coords())
                                 .executes(context -> {
                                     Coords coords = Arguments.getCoords(context, ArgumentNames.POS);
                                     boolean removed = CustomBeaconProvider.remove(coords);
@@ -37,7 +37,7 @@ class BeaconCommandBuilder {
                                 })));
     }
 
-    private static int addBeacon(CommandContext<CommandSource> context) throws CommandSyntaxException {
+    private static int addBeacon(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
         Coords coords = Arguments.getCoords(context, ArgumentNames.POS);
         int level = Arguments.getInteger(context, LEVEL);
 
index 7670bbc88e420f018a78c7be93d892c289272a4a..e8530ad7e1d9413c629f5917c37caaa7fcbb3ffe 100644 (file)
@@ -5,25 +5,25 @@ import com.irtimaled.bbor.common.models.Coords;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
 import com.mojang.brigadier.context.CommandContext;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.Commands;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.ServerCommandSource;
 
 class BoxCommandBuilder {
-    static LiteralArgumentBuilder<CommandSource> build(String command) {
-        return Commands.literal(command)
-                .then(Commands.literal(ArgumentNames.ADD)
-                        .then(Commands.argument(ArgumentNames.FROM, Arguments.coords())
-                                .then(Commands.argument(ArgumentNames.TO, Arguments.coords())
+    static LiteralArgumentBuilder<ServerCommandSource> build(String command) {
+        return CommandManager.literal(command)
+                .then(CommandManager.literal(ArgumentNames.ADD)
+                        .then(CommandManager.argument(ArgumentNames.FROM, Arguments.coords())
+                                .then(CommandManager.argument(ArgumentNames.TO, Arguments.coords())
                                         .executes(BoxCommandBuilder::addBox))))
-                .then(Commands.literal(ArgumentNames.CLEAR)
+                .then(CommandManager.literal(ArgumentNames.CLEAR)
                         .executes(context -> {
                             CustomBoxProvider.clear();
 
                             CommandHelper.feedback(context, "bbor.commands.box.cleared.all");
                             return 0;
                         })
-                        .then(Commands.argument(ArgumentNames.FROM, Arguments.coords())
-                                .then(Commands.argument(ArgumentNames.TO, Arguments.coords())
+                        .then(CommandManager.argument(ArgumentNames.FROM, Arguments.coords())
+                                .then(CommandManager.argument(ArgumentNames.TO, Arguments.coords())
                                         .executes(context -> {
                                             Coords from = Arguments.getCoords(context, ArgumentNames.FROM);
                                             Coords to = Arguments.getCoords(context, ArgumentNames.TO);
@@ -39,7 +39,7 @@ class BoxCommandBuilder {
                                         }))));
     }
 
-    private static int addBox(CommandContext<CommandSource> context) throws CommandSyntaxException {
+    private static int addBox(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
         Coords from = Arguments.getCoords(context, ArgumentNames.FROM);
         Coords to = Arguments.getCoords(context, ArgumentNames.TO);
         Coords minCoords = getMinCoords(from, to);
index bd432de5121f0bea5fb6c8302d95874201df15e1..810fbe829c4a27bccfac0490b310dcece2ef62ff 100644 (file)
@@ -4,15 +4,15 @@ 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.TranslationTextComponent;
+import net.minecraft.server.command.ServerCommandSource;
+import net.minecraft.text.TranslatableText;
 
 class CommandHelper {
-    static void feedback(CommandContext<CommandSource> context, String format, Object... values) {
-        context.getSource().sendFeedback(new TranslationTextComponent(format, values), false);
+    static void feedback(CommandContext<ServerCommandSource> context, String format, Object... values) {
+        context.getSource().sendFeedback(new TranslatableText(format, values), false);
     }
 
-    static boolean lastNodeIsLiteral(CommandContext<CommandSource> context, String literal) {
+    static boolean lastNodeIsLiteral(CommandContext<ServerCommandSource> context, String literal) {
         CommandNode lastNode = getLastNode(context);
         if (lastNode instanceof LiteralCommandNode) {
             LiteralCommandNode literalCommandNode = (LiteralCommandNode) lastNode;
@@ -21,7 +21,7 @@ class CommandHelper {
         return false;
     }
 
-    private static CommandNode getLastNode(CommandContext<CommandSource> context) {
+    private static CommandNode getLastNode(CommandContext<ServerCommandSource> context) {
         ParsedCommandNode[] nodes = context.getNodes().toArray(new ParsedCommandNode[0]);
         if (nodes.length == 0) return null;
         return nodes[nodes.length - 1].getNode();
index c652c93acb37ae33bf04b968b1b4661b09d7bcb9..cca87cf59796b39317db9d536c1cd3b45cd2fede 100644 (file)
@@ -8,9 +8,9 @@ import com.mojang.brigadier.Command;
 import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.arguments.ArgumentType;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.Commands;
-import net.minecraft.command.ISuggestionProvider;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.CommandSource;
+import net.minecraft.server.command.ServerCommandSource;
 
 import java.util.function.Function;
 
@@ -22,8 +22,8 @@ public class ConfigCommand {
     private static final String VALUE = "value";
     private static final String RESET = "reset";
 
-    public static void register(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
-        LiteralArgumentBuilder command = Commands.literal(COMMAND)
+    public static void register(CommandDispatcher<CommandSource> commandDispatcher) {
+        LiteralArgumentBuilder command = CommandManager.literal(COMMAND)
                 .then(buildCommands(GET, ConfigCommand::getCommandForSetting))
                 .then(buildCommands(ArgumentNames.SET, ConfigCommand::setCommandForSetting))
                 .then(buildCommands(RESET, ConfigCommand::resetCommandForSetting)
@@ -32,12 +32,12 @@ public class ConfigCommand {
                             ConfigManager.saveConfig();
                             return 0;
                         }))
-                .then(Commands.literal(SAVE)
+                .then(CommandManager.literal(SAVE)
                         .executes(context -> {
                             ConfigManager.saveConfig();
                             return 0;
                         }))
-                .then(Commands.literal(SHOW_GUI)
+                .then(CommandManager.literal(SHOW_GUI)
                         .executes(context -> {
                             SettingsScreen.show();
                             return 0;
@@ -46,8 +46,8 @@ public class ConfigCommand {
         commandDispatcher.register(command);
     }
 
-    private static LiteralArgumentBuilder<CommandSource> resetCommandForSetting(Setting<?> setting) {
-        return Commands.literal(setting.getName())
+    private static LiteralArgumentBuilder<ServerCommandSource> resetCommandForSetting(Setting<?> setting) {
+        return CommandManager.literal(setting.getName())
                 .executes(context -> {
                     setting.reset();
                     ConfigManager.saveConfig();
@@ -55,27 +55,27 @@ public class ConfigCommand {
                 });
     }
 
-    private interface CommandBuilder extends Function<Setting<?>, LiteralArgumentBuilder<CommandSource>> {
+    private interface CommandBuilder extends Function<Setting<?>, LiteralArgumentBuilder<ServerCommandSource>> {
     }
 
-    private static LiteralArgumentBuilder<CommandSource> buildCommands(String commandName, CommandBuilder commandBuilder) {
-        LiteralArgumentBuilder<CommandSource> command = Commands.literal(commandName);
+    private static LiteralArgumentBuilder<ServerCommandSource> buildCommands(String commandName, CommandBuilder commandBuilder) {
+        LiteralArgumentBuilder<ServerCommandSource> command = CommandManager.literal(commandName);
         for (Setting<?> setting : ConfigManager.getSettings()) {
             command.then(commandBuilder.apply(setting));
         }
         return command;
     }
 
-    private static LiteralArgumentBuilder<CommandSource> getCommandForSetting(Setting<?> setting) {
-        return Commands.literal(setting.getName())
+    private static LiteralArgumentBuilder<ServerCommandSource> getCommandForSetting(Setting<?> setting) {
+        return CommandManager.literal(setting.getName())
                 .executes(context -> {
                     CommandHelper.feedback(context, "%s: %s", setting.getName(), setting.get());
                     return 0;
                 });
     }
 
-    private static LiteralArgumentBuilder<CommandSource> setCommandForSetting(Setting<?> setting) {
-        LiteralArgumentBuilder<CommandSource> command = Commands.literal(setting.getName());
+    private static LiteralArgumentBuilder<ServerCommandSource> setCommandForSetting(Setting<?> setting) {
+        LiteralArgumentBuilder<ServerCommandSource> command = CommandManager.literal(setting.getName());
         switch (setting.getType()) {
             case 'B':
                 buildSetSettingCommand(command, (Setting<Boolean>) setting, Arguments.bool(), Boolean.class);
@@ -93,18 +93,18 @@ public class ConfigCommand {
         return command;
     }
 
-    private static <T> void buildSetSettingCommand(LiteralArgumentBuilder<CommandSource> command,
+    private static <T> void buildSetSettingCommand(LiteralArgumentBuilder<ServerCommandSource> command,
                                                    Setting<T> setting, ArgumentType<T> argument, Class<T> clazz) {
-        Command<CommandSource> setSettingCommand = context -> {
+        Command<ServerCommandSource> setSettingCommand = context -> {
             setting.set(context.getArgument(VALUE, clazz));
             if (CommandHelper.lastNodeIsLiteral(context, SAVE)) {
                 ConfigManager.saveConfig();
             }
             return 0;
         };
-        command.then(Commands.argument(VALUE, argument)
+        command.then(CommandManager.argument(VALUE, argument)
                 .executes(setSettingCommand)
-                .then(Commands.literal(SAVE)
+                .then(CommandManager.literal(SAVE)
                         .executes(setSettingCommand)));
     }
 }
index 56620ed084fff3879b00ccf0ae73616fb1384e82..4b1a137319d54c426f5167b7084fcc630726431c 100644 (file)
@@ -6,8 +6,8 @@ import com.irtimaled.bbor.client.providers.CustomLineProvider;
 import com.irtimaled.bbor.client.providers.CustomSphereProvider;
 import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
-import net.minecraft.command.Commands;
-import net.minecraft.command.ISuggestionProvider;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.CommandSource;
 
 public class CustomCommand {
     private static final String COMMAND = "bbor:custom";
@@ -16,13 +16,13 @@ public class CustomCommand {
     private static final String LINE = "line";
     private static final String SPHERE = "sphere";
 
-    public static void register(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
-        LiteralArgumentBuilder command = Commands.literal(COMMAND)
+    public static void register(CommandDispatcher<CommandSource> commandDispatcher) {
+        LiteralArgumentBuilder command = CommandManager.literal(COMMAND)
                 .then(BoxCommandBuilder.build(BOX))
                 .then(BeaconCommandBuilder.build(BEACON))
                 .then(LineCommandBuilder.build(LINE))
                 .then(SphereCommandBuilder.build(SPHERE))
-                .then(Commands.literal(ArgumentNames.CLEAR)
+                .then(CommandManager.literal(ArgumentNames.CLEAR)
                         .executes(context -> {
                             CustomBoxProvider.clear();
                             CustomBeaconProvider.clear();
@@ -35,4 +35,3 @@ public class CustomCommand {
         commandDispatcher.register(command);
     }
 }
-
index 411f59aa7ff2858814fa37f5062187097610b46f..49ccd330e4b920eb7f779f57dd18303f4a3b47d7 100644 (file)
@@ -5,29 +5,29 @@ import com.irtimaled.bbor.client.providers.CustomLineProvider;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
 import com.mojang.brigadier.context.CommandContext;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.Commands;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.ServerCommandSource;
 
 class LineCommandBuilder {
     private static final String WIDTH = "width";
 
-    static LiteralArgumentBuilder<CommandSource> build(String command) {
-        return Commands.literal(command)
-                .then(Commands.literal(ArgumentNames.ADD)
-                        .then(Commands.argument(ArgumentNames.FROM, Arguments.point())
-                                .then(Commands.argument(ArgumentNames.TO, Arguments.point())
+    static LiteralArgumentBuilder<ServerCommandSource> build(String command) {
+        return CommandManager.literal(command)
+                .then(CommandManager.literal(ArgumentNames.ADD)
+                        .then(CommandManager.argument(ArgumentNames.FROM, Arguments.point())
+                                .then(CommandManager.argument(ArgumentNames.TO, Arguments.point())
                                         .executes(LineCommandBuilder::addLine)
-                                        .then(Commands.argument(WIDTH, Arguments.doubleArg())
+                                        .then(CommandManager.argument(WIDTH, Arguments.doubleArg())
                                                 .executes(LineCommandBuilder::addLine)))))
-                .then(Commands.literal(ArgumentNames.CLEAR)
+                .then(CommandManager.literal(ArgumentNames.CLEAR)
                         .executes(context -> {
                             CustomLineProvider.clear();
 
                             CommandHelper.feedback(context, "bbor.commands.line.cleared.all");
                             return 0;
                         })
-                        .then(Commands.argument(ArgumentNames.FROM, Arguments.coords())
-                                .then(Commands.argument(ArgumentNames.TO, Arguments.coords())
+                        .then(CommandManager.argument(ArgumentNames.FROM, Arguments.coords())
+                                .then(CommandManager.argument(ArgumentNames.TO, Arguments.coords())
                                         .executes(context -> {
                                             Point from = Arguments.getPoint(context, ArgumentNames.FROM).snapXZ(0.5d);
                                             Point to = Arguments.getPoint(context, ArgumentNames.TO).snapXZ(0.5d);
@@ -41,7 +41,7 @@ class LineCommandBuilder {
                                         }))));
     }
 
-    private static int addLine(CommandContext<CommandSource> context) throws CommandSyntaxException {
+    private static int addLine(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
         Point from = Arguments.getPoint(context, ArgumentNames.FROM).snapXZ(0.5d);
         Point to = Arguments.getPoint(context, ArgumentNames.TO).snapXZ(0.5d);
         Double width = Arguments.getDouble(context, WIDTH);
index 879f1b902569bfd8ce0e437a8d41b018484bff2d..e2e56aca759aeb912102b3610898f7a54328baf7 100644 (file)
@@ -3,16 +3,16 @@ package com.irtimaled.bbor.client.commands;
 import com.irtimaled.bbor.client.providers.SlimeChunkProvider;
 import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
-import net.minecraft.command.Commands;
-import net.minecraft.command.ISuggestionProvider;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.CommandSource;
 
 public class SeedCommand {
     private static final String COMMAND = "bbor:seed";
     private static final String SEED = "seed";
 
-    public static void register(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
-        LiteralArgumentBuilder command = Commands.literal(COMMAND)
-                .then(Commands.argument(SEED, Arguments.string())
+    public static void register(CommandDispatcher<CommandSource> commandDispatcher) {
+        LiteralArgumentBuilder command = CommandManager.literal(COMMAND)
+                .then(CommandManager.argument(SEED, Arguments.string())
                         .executes(context -> {
                             String argument = Arguments.getString(context, SEED);
                             handleSeedCommand(argument);
index 8ab9f1b1e0700301916ec2a06dd47c95bc8e6dc6..88725956a1c005b0eed15ffac749522804837299 100644 (file)
@@ -6,10 +6,10 @@ import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
 import com.mojang.brigadier.context.CommandContext;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.Commands;
-import net.minecraft.command.ISuggestionProvider;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.CommandSource;
+import net.minecraft.server.command.ServerCommandSource;
 import net.minecraft.world.LightType;
 import net.minecraft.world.World;
 
@@ -17,13 +17,13 @@ public class SpawningSphereCommand {
     private static final String COMMAND = "bbor:spawningSphere";
     private static final String CALCULATE_SPAWNABLE = "calculateSpawnable";
 
-    public static void register(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
-        LiteralArgumentBuilder command = Commands.literal(COMMAND)
-                .then(Commands.literal(ArgumentNames.SET)
-                        .then(Commands.argument(ArgumentNames.POS, Arguments.point())
+    public static void register(CommandDispatcher<CommandSource> commandDispatcher) {
+        LiteralArgumentBuilder command = CommandManager.literal(COMMAND)
+                .then(CommandManager.literal(ArgumentNames.SET)
+                        .then(CommandManager.argument(ArgumentNames.POS, Arguments.point())
                                 .executes(SpawningSphereCommand::setSphere))
                         .executes(SpawningSphereCommand::setSphere))
-                .then(Commands.literal(ArgumentNames.CLEAR)
+                .then(CommandManager.literal(ArgumentNames.CLEAR)
                         .executes(context -> {
                             boolean cleared = SpawningSphereProvider.clearSphere();
 
@@ -31,7 +31,7 @@ public class SpawningSphereCommand {
                             CommandHelper.feedback(context, format);
                             return 0;
                         }))
-                .then(Commands.literal(CALCULATE_SPAWNABLE)
+                .then(CommandManager.literal(CALCULATE_SPAWNABLE)
                         .executes(context -> {
                             if (!SpawningSphereProvider.hasSpawningSphereInDimension(Player.getDimensionId())) {
                                 CommandHelper.feedback(context, "bbor.commands.spawningSphere.notSet");
@@ -39,10 +39,10 @@ public class SpawningSphereCommand {
                             }
 
                             Counts counts = new Counts();
-                            World world = Minecraft.getInstance().world;
+                            World world = MinecraftClient.getInstance().world;
                             SpawningSphereProvider.calculateSpawnableSpacesCount(pos -> {
                                 counts.spawnable++;
-                                if (world.getLightFor(LightType.SKY, pos) > 7)
+                                if (world.getLightLevel(LightType.SKY, pos) > 7)
                                     counts.nightSpawnable++;
                             });
                             SpawningSphereProvider.setSpawnableSpacesCount(counts.spawnable);
@@ -55,7 +55,7 @@ public class SpawningSphereCommand {
         commandDispatcher.register(command);
     }
 
-    public static int setSphere(CommandContext<CommandSource> context) throws CommandSyntaxException {
+    public static int setSphere(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
         SpawningSphereProvider.setSphere(Arguments.getPoint(context, ArgumentNames.POS).snapXZ(0.5d));
 
         CommandHelper.feedback(context, "bbor.commands.spawningSphere.set");
index 1a8d2b2e20e99b8e8d907fa174f1164640b201fc..5d838bbf3fdd3c3053c5ed766a10184be8ee72c7 100644 (file)
@@ -5,29 +5,29 @@ import com.irtimaled.bbor.client.providers.CustomSphereProvider;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
 import com.mojang.brigadier.context.CommandContext;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.command.CommandSource;
-import net.minecraft.command.Commands;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.ServerCommandSource;
 
 class SphereCommandBuilder {
     public static final String RADIUS = "radius";
 
-    static LiteralArgumentBuilder<CommandSource> build(String command) {
-        return Commands.literal(command)
-                .then(Commands.literal(ArgumentNames.ADD)
-                        .then(Commands.argument(ArgumentNames.POS, Arguments.point())
-                                .then(Commands.argument(RADIUS, Arguments.integer())
+    static LiteralArgumentBuilder<ServerCommandSource> build(String command) {
+        return CommandManager.literal(command)
+                .then(CommandManager.literal(ArgumentNames.ADD)
+                        .then(CommandManager.argument(ArgumentNames.POS, Arguments.point())
+                                .then(CommandManager.argument(RADIUS, Arguments.integer())
                                         .executes(SphereCommandBuilder::addSphere)))
-                        .then(Commands.argument(RADIUS, Arguments.integer())
+                        .then(CommandManager.argument(RADIUS, Arguments.integer())
                                 .executes(SphereCommandBuilder::addSphere)))
-                .then(Commands.literal(ArgumentNames.CLEAR)
+                .then(CommandManager.literal(ArgumentNames.CLEAR)
                         .executes(context -> {
                             CustomSphereProvider.clear();
 
                             CommandHelper.feedback(context, "bbor.commands.sphere.cleared.all");
                             return 0;
                         })
-                        .then(Commands.argument(ArgumentNames.FROM, Arguments.coords())
-                                .then(Commands.argument(ArgumentNames.TO, Arguments.coords())
+                        .then(CommandManager.argument(ArgumentNames.FROM, Arguments.coords())
+                                .then(CommandManager.argument(ArgumentNames.TO, Arguments.coords())
                                         .executes(context -> {
                                             Point pos = Arguments.getPoint(context, ArgumentNames.POS).snapXZ(0.5d);
                                             boolean removed = CustomSphereProvider.remove(pos);
@@ -39,7 +39,7 @@ class SphereCommandBuilder {
                                         }))));
     }
 
-    private static int addSphere(CommandContext<CommandSource> context) throws CommandSyntaxException {
+    private static int addSphere(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
         Point pos = Arguments.getPoint(context, ArgumentNames.POS).snapXZ(0.5d);
         int radius = Arguments.getInteger(context, RADIUS);
         CustomSphereProvider.add(pos, radius);
index 6b950d424ce286bdc3881f7de032bbe3bcb8fe99..b6f795a913d86f8d517190e4a92b65da1732d234 100644 (file)
@@ -4,21 +4,21 @@ import com.irtimaled.bbor.client.gui.LoadSavesScreen;
 import com.irtimaled.bbor.client.interop.ClientInterop;
 import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.builder.LiteralArgumentBuilder;
-import net.minecraft.command.Commands;
-import net.minecraft.command.ISuggestionProvider;
+import net.minecraft.server.command.CommandManager;
+import net.minecraft.server.command.CommandSource;
 
 public class StructuresCommand {
     private static final String COMMAND = "bbor:structures";
     private static final String LOAD = "load";
 
-    public static void register(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
-        LiteralArgumentBuilder command = Commands.literal(COMMAND)
-                .then(Commands.literal(LOAD)
+    public static void register(CommandDispatcher<CommandSource> commandDispatcher) {
+        LiteralArgumentBuilder command = CommandManager.literal(COMMAND)
+                .then(CommandManager.literal(LOAD)
                         .executes(context -> {
                             LoadSavesScreen.show();
                             return 0;
                         }))
-                .then(Commands.literal(ArgumentNames.CLEAR)
+                .then(CommandManager.literal(ArgumentNames.CLEAR)
                         .executes(context -> {
                             ClientInterop.clearStructures();
                             return 0;
index 5fd816af86a63429a8b74a57f5ceb6297108aae8..7ccf4bab20ce351a25aae49747a8a31f65112d92 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor.client.gui;
 
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 
 abstract class AbstractButton extends AbstractControl {
     AbstractButton(int x, int y, int width, String name) {
@@ -24,7 +24,7 @@ abstract class AbstractButton extends AbstractControl {
             if (key != 257 && key != 32 && key != 335) {
                 return false;
             } else {
-                this.playDownSound(Minecraft.getInstance().getSoundHandler());
+                this.playDownSound(MinecraftClient.getInstance().getSoundManager());
                 this.onPressed();
                 return true;
             }
index 6201d6f5dfba653b31ab3015e57b9e48f5ac0108..da9de112d30d2275d1b43bcf02c92386898b22f8 100644 (file)
@@ -1,17 +1,17 @@
 package com.irtimaled.bbor.client.gui;
 
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.widget.Widget;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.widget.AbstractButtonWidget;
 
 import java.awt.*;
 
-abstract class AbstractControl extends Widget implements IControl {
+abstract class AbstractControl extends AbstractButtonWidget implements IControl {
     private static final int PADDING = 4;
-    protected final Minecraft minecraft;
+    protected final MinecraftClient minecraft;
 
     AbstractControl(int x, int y, int width, String name) {
         super(x, y, width, 20, name);
-        this.minecraft = Minecraft.getInstance();
+        this.minecraft = MinecraftClient.getInstance();
     }
 
     @Override
@@ -36,7 +36,7 @@ abstract class AbstractControl extends Widget implements IControl {
     }
 
     @Override
-    protected void renderBg(Minecraft minecraft, int mouseX, int mouseY) {
+    protected void renderBg(MinecraftClient minecraft, int mouseX, int mouseY) {
         if (active) renderBackground(mouseX, mouseY);
     }
 
index db1431c57b270cd2614e593498f4b87e9a6cf999..1ec236cfca49fce09da6060ac2b5df7b4fefe01f 100644 (file)
@@ -1,8 +1,8 @@
 package com.irtimaled.bbor.client.gui;
 
 import com.irtimaled.bbor.common.MathHelper;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.audio.SoundHandler;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.sound.SoundManager;
 
 abstract class AbstractSlider extends AbstractControl {
     private final int optionCount;
@@ -70,11 +70,11 @@ abstract class AbstractSlider extends AbstractControl {
     }
 
     @Override
-    public void playDownSound(SoundHandler soundHandler) {
+    public void playDownSound(SoundManager soundHandler) {
     }
 
     @Override
     public void onRelease(double mouseX, double mouseY) {
-        super.playDownSound(Minecraft.getInstance().getSoundHandler());
+        super.playDownSound(MinecraftClient.getInstance().getSoundManager());
     }
 }
index 21db3285930950f660f6f91c0c85b2cef293fa33..9331c63998ded6ab70e5a37adfa563bd6afbd010 100644 (file)
@@ -3,13 +3,13 @@ package com.irtimaled.bbor.client.gui;
 import com.irtimaled.bbor.client.renderers.RenderHelper;
 import com.irtimaled.bbor.client.renderers.Renderer;
 import com.irtimaled.bbor.common.MathHelper;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.AbstractGui;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.DrawableHelper;
 
 import java.util.ArrayList;
 import java.util.List;
 
-public class ControlList extends AbstractGui implements IControlSet {
+public class ControlList extends DrawableHelper implements IControlSet {
     public static final int CONTROLS_WIDTH = 310;
     protected static final int PADDING = 8;
 
@@ -17,7 +17,7 @@ public class ControlList extends AbstractGui implements IControlSet {
     protected final List<ControlListEntry> entries = new ArrayList<>();
     private final int scrollBarLeft;
     private final int listHeight;
-    private final Minecraft minecraft;
+    private final MinecraftClient minecraft;
     private final int width;
     private final int height;
     private final int top;
@@ -31,7 +31,7 @@ public class ControlList extends AbstractGui implements IControlSet {
     private boolean isDragging;
 
     ControlList(int width, int height, int top, int bottom) {
-        this.minecraft = Minecraft.getInstance();
+        this.minecraft = MinecraftClient.getInstance();
         this.width = width;
         this.scrollBarLeft = width - 6;
         this.height = height;
@@ -185,7 +185,7 @@ public class ControlList extends AbstractGui implements IControlSet {
     }
 
     private void drawListBackground() {
-        this.minecraft.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION);
+        this.minecraft.getTextureManager().bindTexture(DrawableHelper.BACKGROUND_LOCATION);
         Renderer.startTextured()
                 .setColor(32, 32, 32)
                 .setAlpha(255)
@@ -214,7 +214,7 @@ public class ControlList extends AbstractGui implements IControlSet {
     }
 
     private void overlayBackground(int top, int bottom) {
-        this.minecraft.getTextureManager().bindTexture(AbstractGui.BACKGROUND_LOCATION);
+        this.minecraft.getTextureManager().bindTexture(DrawableHelper.BACKGROUND_LOCATION);
         Renderer.startTextured()
                 .setColor(64, 64, 64)
                 .setAlpha(255)
index dba872b9402869a8b4489d0fbaee5f8f9b809ea4..9e90ade2ece84c6d748c43b5647ab15c17bb9866 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor.client.gui;
 
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -9,7 +9,7 @@ public class ControlListSection extends ControlListEntry implements IControlSet
     private static final int TITLE_HEIGHT = 16;
     private final String title;
     private final List<AbstractControl> controls = new ArrayList<>();
-    private final Minecraft minecraft = Minecraft.getInstance();
+    private final MinecraftClient minecraft = MinecraftClient.getInstance();
     private final int titleHeight;
     private int height;
     private IControl focused;
@@ -37,7 +37,7 @@ public class ControlListSection extends ControlListEntry implements IControlSet
     }
 
     private int columnCount() {
-        switch (minecraft.getLanguageManager().getCurrentLanguage().getCode()) {
+        switch (minecraft.getLanguageManager().getLanguage().getCode()) {
             case "en_au":
             case "en_us":
             case "en_gb":
@@ -52,7 +52,7 @@ public class ControlListSection extends ControlListEntry implements IControlSet
         int y = this.getY();
         int top = y;
         if (this.title != null) {
-            this.minecraft.fontRenderer.drawString(this.title, x + 4, y + ((TITLE_HEIGHT - this.minecraft.fontRenderer.FONT_HEIGHT) / 1.5f), 16777215);
+            this.minecraft.textRenderer.draw(this.title, x + 4, y + ((TITLE_HEIGHT - this.minecraft.textRenderer.fontHeight) / 1.5f), 16777215);
             top += titleHeight;
         }
 
index 871db3829d1709149454356ff48628dda787a1a0..dd9c8de742a5cdcd430b6ee95b35d1bd9227934a 100644 (file)
@@ -1,8 +1,8 @@
 package com.irtimaled.bbor.client.gui;
 
-import net.minecraft.client.gui.IGuiEventListener;
+import net.minecraft.client.gui.Element;
 
-interface IControl extends IFocusableControl, IGuiEventListener {
+interface IControl extends IFocusableControl, Element {
     void render(int mouseX, int mouseY);
 
     boolean isVisible();
index 86a9b377d4b65c033be14352e7e8fee54f9edbb3..aa924314bb655e5818307267ab857ca4def95ecb 100644 (file)
@@ -1,10 +1,10 @@
 package com.irtimaled.bbor.client.gui;
 
-import net.minecraft.client.gui.IGuiEventListener;
+import net.minecraft.client.gui.Element;
 
 import java.util.List;
 
-public interface IControlSet extends IFocusableControl, IGuiEventListener {
+public interface IControlSet extends IFocusableControl, Element {
     List<? extends IControl> controls();
 
     IControl getFocused();
index e94cdeb522b0afca15c67121f1a7ff3f908ee6d2..36548cbf8827c2cd9cd5ec0c25850707599e6e20 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.client.gui;
 
 import com.irtimaled.bbor.client.config.Setting;
-import net.minecraft.client.resources.I18n;
+import net.minecraft.client.resource.language.I18n;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -40,7 +40,7 @@ class IntSettingSlider extends AbstractSlider {
 
     private void updateText() {
         Integer value = setting.get();
-        this.setMessage(I18n.format(format, displayValues.getOrDefault(value, value.toString())));
+        this.setMessage(I18n.translate(format, displayValues.getOrDefault(value, value.toString())));
     }
 
     @Override
index 7e6e9bbd6ff32687323635440ada22fc0ca8d506..ea1ab200e608996fd8e2724f545548cab18cac33 100644 (file)
@@ -2,10 +2,10 @@ package com.irtimaled.bbor.client.gui;
 
 import com.irtimaled.bbor.Versions;
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.gui.IGuiEventListener;
+import net.minecraft.client.gui.Element;
 import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.resources.I18n;
-import net.minecraft.util.text.StringTextComponent;
+import net.minecraft.client.resource.language.I18n;
+import net.minecraft.text.LiteralText;
 
 public abstract class ListScreen extends Screen {
     private final Screen lastScreen;
@@ -16,7 +16,7 @@ public abstract class ListScreen extends Screen {
     private SearchField searchField;
 
     ListScreen(Screen lastScreen) {
-        super(new StringTextComponent("Bounding Box Outline Reloaded"));
+        super(new LiteralText("Bounding Box Outline Reloaded"));
         this.lastScreen = lastScreen;
     }
 
@@ -32,7 +32,7 @@ public abstract class ListScreen extends Screen {
     protected void init() {
         this.controlList = this.buildList(48, this.height - 28);
         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")) {
+        this.doneButton = new AbstractButton(this.width / 2 - 100, this.height - 24, 200, I18n.translate("gui.done")) {
             @Override
             public void onPressed() {
                 onDoneClicked();
@@ -54,7 +54,7 @@ public abstract class ListScreen extends Screen {
     protected void render(int mouseX, int mouseY) {
         this.controlList.render(mouseX, mouseY);
 
-        this.drawCenteredString(this.font, this.title.getUnformattedComponentText(), this.width / 2, 8, 16777215);
+        this.drawCenteredString(this.font, this.title.asString(), this.width / 2, 8, 16777215);
         this.searchField.render(mouseX, mouseY);
         this.doneButton.render(mouseX, mouseY);
 
@@ -94,9 +94,9 @@ public abstract class ListScreen extends Screen {
 
     @Override
     public boolean mouseClicked(double mouseX, double mouseY, int button) {
-        for (IGuiEventListener control : this.children()) {
+        for (Element control : this.children()) {
             if (control.mouseClicked(mouseX, mouseY, button)) {
-                IGuiEventListener focused = getFocused();
+                Element focused = getFocused();
                 if (focused instanceof IFocusableControl && focused != control) {
                     ((IFocusableControl) focused).clearFocus();
                 }
index 90a4a01eb5b2e48ed3a6479ced6a2c432540da30..c44fd9466510ba1211b5163bdfcaa391bf0cfd84 100644 (file)
@@ -1,9 +1,9 @@
 package com.irtimaled.bbor.client.gui;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.AnvilConverterException;
-import net.minecraft.world.storage.SaveFormat;
-import net.minecraft.world.storage.WorldSummary;
+import net.minecraft.world.level.storage.LevelStorage;
+import net.minecraft.world.level.storage.LevelStorageException;
+import net.minecraft.world.level.storage.LevelSummary;
 
 import java.util.List;
 
@@ -18,11 +18,11 @@ public class LoadSavesScreen extends ListScreen {
     protected ControlList buildList(int top, int bottom) {
         controlList = new SelectableControlList(this.width, this.height, top, bottom);
         try {
-            final SaveFormat saveLoader = this.minecraft.getSaveLoader();
-            List<WorldSummary> saveList = saveLoader.getSaveList();
+            final LevelStorage saveLoader = this.minecraft.getLevelStorage();
+            List<LevelSummary> saveList = saveLoader.getLevelList();
             saveList.sort(null);
             saveList.forEach(world -> controlList.add(new WorldSaveRow(world, saveLoader, controlList::setSelectedEntry)));
-        } catch (AnvilConverterException e) {
+        } catch (LevelStorageException e) {
             e.printStackTrace();
         }
         return controlList;
index 4e3651a122982ca9db6a6b6092478bbe223856ba..e9e71b3625d83b62736860c5529875c3a96d58d9 100644 (file)
@@ -1,18 +1,18 @@
 package com.irtimaled.bbor.client.gui;
 
 import com.irtimaled.bbor.client.config.Setting;
-import net.minecraft.client.resources.I18n;
+import net.minecraft.client.resource.language.I18n;
 
 class MaxYSettingSlider extends IntSettingSlider {
     private final int actualMinValue;
 
     MaxYSettingSlider(int width, int minValue, Setting<Integer> setting) {
-        super(width, minValue - 2, 127, I18n.format("bbor.options.maxY", "%s"), setting);
+        super(width, minValue - 2, 127, I18n.translate("bbor.options.maxY", "%s"), setting);
         this.actualMinValue = minValue;
         this.setInitialPosition();
-        this.addDisplayValue(-1, I18n.format("bbor.options.maxY.activated"));
-        this.addDisplayValue(0, I18n.format("bbor.options.maxY.player"));
-        this.addDisplayValue(63, I18n.format("bbor.options.maxY.seaLevel"));
+        this.addDisplayValue(-1, I18n.translate("bbor.options.maxY.activated"));
+        this.addDisplayValue(0, I18n.translate("bbor.options.maxY.player"));
+        this.addDisplayValue(63, I18n.translate("bbor.options.maxY.seaLevel"));
     }
 
     @Override
index a0577f566e733cf1f80e0f1409b371407ee7c29e..272e6dd3769ebf54de63aa63e913fafaf3105b94 100644 (file)
@@ -1,17 +1,17 @@
 package com.irtimaled.bbor.client.gui;
 
-import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.font.TextRenderer;
 import net.minecraft.client.gui.widget.TextFieldWidget;
 
 public class SearchField extends TextFieldWidget implements IControl {
     private final ControlList controlList;
 
-    SearchField(FontRenderer fontRenderer, int left, int top, int width, int height, ControlList controlList) {
+    SearchField(TextRenderer fontRenderer, int left, int top, int width, int height, ControlList controlList) {
         super(fontRenderer, left, top, width, height, "");
 
         this.controlList = controlList;
-        this.setResponder(text -> this.controlList.filter(removeLeadingSpaces(text.toLowerCase())));
-        this.setTextFormatter((text, id) -> removeLeadingSpaces(text));
+        this.setChangedListener(text -> this.controlList.filter(removeLeadingSpaces(text.toLowerCase())));
+        this.setRenderTextProvider((text, id) -> removeLeadingSpaces(text));
         this.setFocused(true);
     }
 
@@ -26,6 +26,6 @@ public class SearchField extends TextFieldWidget implements IControl {
 
     @Override
     public boolean isVisible() {
-        return super.getVisible();
+        return super.isVisible();
     }
 }
index bd037e79c9592548238ff97be6dc9d2a611381ec..958194c71e63b24dae6b18fd5d7913a64055739f 100644 (file)
@@ -4,9 +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.SharedConstants;
 import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.resources.I18n;
-import net.minecraft.util.SharedConstants;
+import net.minecraft.client.resource.language.I18n;
 
 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).*";
@@ -29,13 +29,13 @@ public class SettingsScreen extends ListScreen {
 
     @Override
     protected ControlList buildList(int top, int bottom) {
-        String version = SharedConstants.getVersion().getName();
+        String version = SharedConstants.getGameVersion().getName();
         ControlList controlList = new ControlList(this.width, this.height, top, bottom);
         if (this.minecraft.world != null) controlList.setTransparentBackground();
 
         controlList
                 .section(null,
-                        width -> new BoolButton(width, I18n.format("bbor.options.active"), this.minecraft.world != null) {
+                        width -> new BoolButton(width, I18n.translate("bbor.options.active"), this.minecraft.world != null) {
                             @Override
                             public void onPressed() {
                                 ClientRenderer.toggleActive();
@@ -46,40 +46,40 @@ public class SettingsScreen extends ListScreen {
                                 return ClientRenderer.getActive();
                             }
                         },
-                        width -> new BoolSettingButton(width, I18n.format("bbor.options.outerBoxOnly"), ConfigManager.outerBoxesOnly),
-                        width -> new BoolSettingButton(width, I18n.format("bbor.options.fill"), ConfigManager.fill))
-                .section(I18n.format("bbor.features.spawnChunks"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawnChunks"), BoundingBoxType.WorldSpawn),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.lazyChunks"), BoundingBoxType.LazySpawnChunks),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.options.outerBoxOnly"), ConfigManager.outerBoxesOnly),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.options.fill"), ConfigManager.fill))
+                .section(I18n.translate("bbor.features.spawnChunks"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.spawnChunks"), BoundingBoxType.WorldSpawn),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.lazyChunks"), BoundingBoxType.LazySpawnChunks),
                         width -> new MaxYSettingSlider(width, 39, ConfigManager.worldSpawnMaxY))
-                .section(I18n.format("bbor.features.slimeChunks"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.slimeChunks"), BoundingBoxType.SlimeChunks),
+                .section(I18n.translate("bbor.features.slimeChunks"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.slimeChunks"), BoundingBoxType.SlimeChunks),
                         width -> new MaxYSettingSlider(width, 39, ConfigManager.slimeChunkMaxY))
-                .section(I18n.format("bbor.features.biomeBorders"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.biomeBorders"), BoundingBoxType.BiomeBorder),
+                .section(I18n.translate("bbor.features.biomeBorders"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.biomeBorders"), BoundingBoxType.BiomeBorder),
                         width -> new MaxYSettingSlider(width, 1, ConfigManager.biomeBordersMaxY),
                         width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.biomeBordersRenderDistance)
-                                .addDisplayValue(1, I18n.format("bbor.options.distance.nearest"))
-                                .addDisplayValue(2, I18n.format("bbor.options.distance.nearer"))
-                                .addDisplayValue(3, I18n.format("bbor.options.distance.normal")))
-                .section(I18n.format("bbor.features.flowerForests"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.flowerForests"), BoundingBoxType.FlowerForest),
+                                .addDisplayValue(1, I18n.translate("bbor.options.distance.nearest"))
+                                .addDisplayValue(2, I18n.translate("bbor.options.distance.nearer"))
+                                .addDisplayValue(3, I18n.translate("bbor.options.distance.normal")))
+                .section(I18n.translate("bbor.features.flowerForests"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.flowerForests"), BoundingBoxType.FlowerForest),
                         width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance", ConfigManager.flowerForestsRenderDistance)
-                                .addDisplayValue(1, I18n.format("bbor.options.distance.nearest"))
-                                .addDisplayValue(2, I18n.format("bbor.options.distance.nearer"))
-                                .addDisplayValue(3, I18n.format("bbor.options.distance.normal")))
-                .section(I18n.format("bbor.features.bedrockCeilingBlocks"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.bedrockCeilingBlocks"), BoundingBoxType.BedrockCeiling))
-                .section(I18n.format("bbor.features.mobSpawners"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.mobSpawners"), BoundingBoxType.MobSpawner),
-                        width -> new BoolSettingButton(width, I18n.format("bbor.features.mobSpawners.spawnArea"), ConfigManager.renderMobSpawnerSpawnArea),
-                        width -> new BoolSettingButton(width, I18n.format("bbor.features.mobSpawners.activationLines"), ConfigManager.renderMobSpawnerActivationLines))
-                .section(I18n.format("bbor.sections.beaconsAndConduits"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.beacons"), BoundingBoxType.Beacon),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.conduits"), BoundingBoxType.Conduit),
-                        width -> new BoolSettingButton(width, I18n.format("bbor.features.conduits.mobHarmArea"), ConfigManager.renderConduitMobHarmArea))
-                .section(I18n.format("bbor.features.spawnableBlocks"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawnableBlocks"), BoundingBoxType.SpawnableBlocks),
+                                .addDisplayValue(1, I18n.translate("bbor.options.distance.nearest"))
+                                .addDisplayValue(2, I18n.translate("bbor.options.distance.nearer"))
+                                .addDisplayValue(3, I18n.translate("bbor.options.distance.normal")))
+                .section(I18n.translate("bbor.features.bedrockCeilingBlocks"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.bedrockCeilingBlocks"), BoundingBoxType.BedrockCeiling))
+                .section(I18n.translate("bbor.features.mobSpawners"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.mobSpawners"), BoundingBoxType.MobSpawner),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.features.mobSpawners.spawnArea"), ConfigManager.renderMobSpawnerSpawnArea),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.features.mobSpawners.activationLines"), ConfigManager.renderMobSpawnerActivationLines))
+                .section(I18n.translate("bbor.sections.beaconsAndConduits"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.beacons"), BoundingBoxType.Beacon),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.conduits"), BoundingBoxType.Conduit),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.features.conduits.mobHarmArea"), ConfigManager.renderConduitMobHarmArea))
+                .section(I18n.translate("bbor.features.spawnableBlocks"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.spawnableBlocks"), BoundingBoxType.SpawnableBlocks),
                         width -> new IntSettingSlider(width, 1, 3, "bbor.options.distance.y", ConfigManager.spawnableBlocksRenderHeight)
                                 .addDisplayValue(1, "2")
                                 .addDisplayValue(2, "4")
@@ -88,28 +88,28 @@ public class SettingsScreen extends ListScreen {
                                 .addDisplayValue(1, "8")
                                 .addDisplayValue(2, "16")
                                 .addDisplayValue(3, "32"))
-                .section(I18n.format("bbor.features.spawningSpheres"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.features.spawningSpheres"), BoundingBoxType.AFKSphere),
-                        width -> new BoolSettingButton(width, I18n.format("bbor.features.spawnableBlocks"), ConfigManager.renderAFKSpawnableBlocks))
-                .section(I18n.format("bbor.tabs.structures"),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.desertTemples"), BoundingBoxType.DesertTemple),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.jungleTemples"), BoundingBoxType.JungleTemple),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.witchHuts"), BoundingBoxType.WitchHut),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.mansions"), BoundingBoxType.Mansion),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.monuments"), BoundingBoxType.OceanMonument),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.igloos"), BoundingBoxType.Igloo),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.oceanRuins"), BoundingBoxType.OceanRuin),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.buriedTreasure"), BoundingBoxType.BuriedTreasure),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.shipwrecks"), BoundingBoxType.Shipwreck),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.strongholds"), BoundingBoxType.Stronghold),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.mineshafts"), BoundingBoxType.MineShaft),
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.villages"), BoundingBoxType.Village),
-                        width -> version.matches(pillagerOutpostVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.pillagerOutposts"), BoundingBoxType.PillagerOutpost) : null,
-                        width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.ruinedPortal"), BoundingBoxType.RuinedPortal) : null,
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.fortresses"), BoundingBoxType.NetherFortress),
-                        width -> version.matches(netherFossilVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.netherFossils"), BoundingBoxType.NetherFossil) : null,
-                        width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.format("bbor.structures.bastionRemnants"), BoundingBoxType.BastionRemnant) : null,
-                        width -> new BoundingBoxTypeButton(width, I18n.format("bbor.structures.endCities"), BoundingBoxType.EndCity));
+                .section(I18n.translate("bbor.features.spawningSpheres"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.features.spawningSpheres"), BoundingBoxType.AFKSphere),
+                        width -> new BoolSettingButton(width, I18n.translate("bbor.features.spawnableBlocks"), ConfigManager.renderAFKSpawnableBlocks))
+                .section(I18n.translate("bbor.tabs.structures"),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.desertTemples"), BoundingBoxType.DesertTemple),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.jungleTemples"), BoundingBoxType.JungleTemple),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.witchHuts"), BoundingBoxType.WitchHut),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.mansions"), BoundingBoxType.Mansion),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.monuments"), BoundingBoxType.OceanMonument),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.igloos"), BoundingBoxType.Igloo),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.oceanRuins"), BoundingBoxType.OceanRuin),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.buriedTreasure"), BoundingBoxType.BuriedTreasure),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.shipwrecks"), BoundingBoxType.Shipwreck),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.strongholds"), BoundingBoxType.Stronghold),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.mineshafts"), BoundingBoxType.MineShaft),
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.villages"), BoundingBoxType.Village),
+                        width -> version.matches(pillagerOutpostVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.pillagerOutposts"), BoundingBoxType.PillagerOutpost) : null,
+                        width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.ruinedPortal"), BoundingBoxType.RuinedPortal) : null,
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.fortresses"), BoundingBoxType.NetherFortress),
+                        width -> version.matches(netherFossilVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.netherFossils"), BoundingBoxType.NetherFossil) : null,
+                        width -> version.matches(bastionRemnantVersionPattern) ? new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.bastionRemnants"), BoundingBoxType.BastionRemnant) : null,
+                        width -> new BoundingBoxTypeButton(width, I18n.translate("bbor.structures.endCities"), BoundingBoxType.EndCity));
         return controlList;
     }
 }
index 037dc5fff4508252292f36fbdd403ba6ae097c79..3d88eccc4b72ce04834f91c15c01db986fe3999d 100644 (file)
@@ -3,15 +3,15 @@ package com.irtimaled.bbor.client.gui;
 import com.google.common.hash.Hashing;
 import com.irtimaled.bbor.client.interop.ClientInterop;
 import com.irtimaled.bbor.client.renderers.RenderHelper;
-import net.minecraft.client.Minecraft;
-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.client.MinecraftClient;
+import net.minecraft.client.gui.DrawableHelper;
+import net.minecraft.client.texture.NativeImage;
+import net.minecraft.client.texture.NativeImageBackedTexture;
+import net.minecraft.util.Identifier;
 import net.minecraft.util.Util;
-import net.minecraft.world.storage.SaveFormat;
-import net.minecraft.world.storage.WorldInfo;
-import net.minecraft.world.storage.WorldSummary;
+import net.minecraft.world.level.LevelProperties;
+import net.minecraft.world.level.storage.LevelStorage;
+import net.minecraft.world.level.storage.LevelSummary;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
@@ -26,25 +26,25 @@ import java.util.function.Consumer;
 public class WorldSaveRow extends ControlListEntry implements Comparable<WorldSaveRow> {
     private static final Logger LOGGER = LogManager.getLogger();
     private static final DateFormat DATE_FORMAT = new SimpleDateFormat();
-    private static final ResourceLocation ICON_MISSING = new ResourceLocation("textures/misc/unknown_server.png");
+    private static final Identifier ICON_MISSING = new Identifier("textures/misc/unknown_server.png");
     private static final int ICON_SIZE = 20;
-    private final Minecraft client;
-    private final WorldSummary worldSummary;
-    private final SaveFormat saveLoader;
+    private final MinecraftClient client;
+    private final LevelSummary worldSummary;
+    private final LevelStorage saveLoader;
     private final Consumer<ControlListEntry> setSelectedEntry;
-    private final ResourceLocation iconLocation;
-    private final DynamicTexture icon;
+    private final Identifier iconLocation;
+    private final NativeImageBackedTexture icon;
 
     private File iconFile;
     private long lastClickTime;
 
-    WorldSaveRow(WorldSummary worldSummary, SaveFormat saveLoader, Consumer<ControlListEntry> setSelectedEntry) {
+    WorldSaveRow(LevelSummary worldSummary, LevelStorage saveLoader, Consumer<ControlListEntry> setSelectedEntry) {
         this.worldSummary = worldSummary;
         this.saveLoader = saveLoader;
         this.setSelectedEntry = setSelectedEntry;
-        this.client = Minecraft.getInstance();
-        this.iconLocation = new ResourceLocation("worlds/" + Hashing.sha1().hashUnencodedChars(worldSummary.getFileName()) + "/icon");
-        this.iconFile = saveLoader.getFile(worldSummary.getFileName(), "icon.png");
+        this.client = MinecraftClient.getInstance();
+        this.iconLocation = new Identifier("worlds/" + Hashing.sha1().hashUnencodedChars(worldSummary.getName()) + "/icon");
+        this.iconFile = saveLoader.resolveFile(worldSummary.getName(), "icon.png");
         if (!this.iconFile.isFile()) {
             this.iconFile = null;
         }
@@ -65,34 +65,34 @@ public class WorldSaveRow extends ControlListEntry implements Comparable<WorldSa
         if (!isMouseOver(mouseX, mouseY)) return false;
 
         this.setSelectedEntry.accept(this);
-        if (Util.milliTime() - this.lastClickTime < 250L) {
+        if (Util.getMeasuringTimeMs() - this.lastClickTime < 250L) {
             done();
         } else {
-            this.lastClickTime = Util.milliTime();
+            this.lastClickTime = Util.getMeasuringTimeMs();
         }
         return true;
     }
 
     @Override
     public void done() {
-        String fileName = this.worldSummary.getFileName();
-        WorldInfo worldInfo = saveLoader.getWorldInfo(fileName);
+        String fileName = this.worldSummary.getName();
+        LevelProperties worldInfo = saveLoader.getLevelProperties(fileName);
         long seed = worldInfo.getSeed();
         ClientInterop.saveLoaded(fileName, seed);
     }
 
-    private DynamicTexture loadIcon() {
+    private NativeImageBackedTexture loadIcon() {
         if (this.iconFile == null || !this.iconFile.isFile()) {
-            this.client.getTextureManager().deleteTexture(this.iconLocation);
+            this.client.getTextureManager().destroyTexture(this.iconLocation);
             return null;
         }
 
         try (InputStream stream = new FileInputStream(this.iconFile)) {
-            DynamicTexture texture = new DynamicTexture(NativeImage.read(stream));
-            this.client.getTextureManager().loadTexture(this.iconLocation, texture);
+            NativeImageBackedTexture texture = new NativeImageBackedTexture(NativeImage.read(stream));
+            this.client.getTextureManager().registerTexture(this.iconLocation, texture);
             return texture;
         } catch (Throwable exception) {
-            LOGGER.error("Invalid icon for world {}", this.worldSummary.getFileName(), exception);
+            LOGGER.error("Invalid icon for world {}", this.worldSummary.getName(), exception);
             this.iconFile = null;
             return null;
         }
@@ -101,15 +101,15 @@ public class WorldSaveRow extends ControlListEntry implements Comparable<WorldSa
     @Override
     public void render(int mouseX, int mouseY) {
         String displayName = this.worldSummary.getDisplayName();
-        String details = this.worldSummary.getFileName() + " (" + DATE_FORMAT.format(new Date(this.worldSummary.getLastTimePlayed())) + ")";
+        String details = this.worldSummary.getName() + " (" + DATE_FORMAT.format(new Date(this.worldSummary.getLastPlayed())) + ")";
 
         int x = this.getX();
         int y = this.getY();
-        this.client.fontRenderer.drawString(displayName, (float) (x + ICON_SIZE + 3), (float) (y + 1), 16777215);
-        this.client.fontRenderer.drawString(details, (float) (x + ICON_SIZE + 3), (float) (y + 1 + this.client.fontRenderer.FONT_HEIGHT + 1), 8421504);
+        this.client.textRenderer.draw(displayName, (float) (x + ICON_SIZE + 3), (float) (y + 1), 16777215);
+        this.client.textRenderer.draw(details, (float) (x + ICON_SIZE + 3), (float) (y + 1 + this.client.textRenderer.fontHeight + 1), 8421504);
         this.client.getTextureManager().bindTexture(this.icon != null ? this.iconLocation : ICON_MISSING);
         RenderHelper.enableBlend();
-        AbstractGui.blit(x, y, 0.0F, 0.0F, ICON_SIZE, ICON_SIZE, 32, 32);
+        DrawableHelper.blit(x, y, 0.0F, 0.0F, ICON_SIZE, ICON_SIZE, 32, 32);
         RenderHelper.disableBlend();
     }
 
@@ -117,7 +117,7 @@ public class WorldSaveRow extends ControlListEntry implements Comparable<WorldSa
     public void filter(String lowerValue) {
         super.setVisible(lowerValue.isEmpty() ||
                 this.worldSummary.getDisplayName().toLowerCase().contains(lowerValue) ||
-                this.worldSummary.getFileName().toLowerCase().contains(lowerValue));
+                this.worldSummary.getName().toLowerCase().contains(lowerValue));
     }
 
     @Override
index 5d7e2626688a3173a536eb351f822443fa74d8cd..ebf5d263f3166eecad9119fee615ab02979a5e85 100644 (file)
@@ -2,26 +2,26 @@ package com.irtimaled.bbor.client.interop;
 
 import net.minecraft.block.BlockState;
 import net.minecraft.block.Blocks;
-import net.minecraft.client.Minecraft;
-import net.minecraft.util.SharedSeedRandom;
+import net.minecraft.client.MinecraftClient;
 import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.gen.ChunkRandom;
 
 import java.util.Random;
 
 public class BedrockCeilingHelper {
     public static boolean isBedrock(int x, int y, int z){
         BlockPos pos = new BlockPos(x, y, z);
-        BlockState blockState = Minecraft.getInstance().world.getBlockState(pos);
+        BlockState blockState = MinecraftClient.getInstance().world.getBlockState(pos);
         return blockState == Blocks.BEDROCK.getDefaultState();
     }
 
     public static boolean chunkLoaded(int chunkX, int chunkZ) {
-        return Minecraft.getInstance().world.getChunkProvider().chunkExists(chunkX, chunkZ);
+        return MinecraftClient.getInstance().world.getChunkManager().isChunkLoaded(chunkX, chunkZ);
     }
 
     public static Random getRandomForChunk(int chunkX, int chunkZ) {
-        SharedSeedRandom random = new SharedSeedRandom();
-        random.setBaseChunkSeed(chunkX, chunkZ);
+        ChunkRandom random = new ChunkRandom();
+        random.setSeed(chunkX, chunkZ);
         return random;
     }
 }
index 90e596feed45f12954011b589bb9682681ec89ec..b932f044df8fc8cb966f071bea13d13d1482ad60 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.client.interop;
 
 import com.irtimaled.bbor.common.models.Coords;
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.util.registry.Registry;
 import net.minecraft.world.biome.Biome;
@@ -13,7 +13,7 @@ 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 Registry.BIOME.getId(biome);
+        Biome biome = MinecraftClient.getInstance().world.getBiome(pos);
+        return Registry.BIOME.getRawId(biome);
     }
 }
index 67809c3e933615f5036287fd3f3f4c235879b487..9f3709cb9c57988f53b6425415180069c9c27572 100644 (file)
@@ -12,15 +12,15 @@ import com.irtimaled.bbor.common.TypeHelper;
 import com.irtimaled.bbor.common.models.DimensionId;
 import com.mojang.brigadier.CommandDispatcher;
 import com.mojang.brigadier.exceptions.CommandSyntaxException;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.entity.player.ClientPlayerEntity;
+import net.minecraft.client.MinecraftClient;
 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.client.network.ClientPlayNetworkHandler;
+import net.minecraft.client.network.ClientPlayerEntity;
+import net.minecraft.server.command.CommandSource;
+import net.minecraft.server.command.ServerCommandSource;
+import net.minecraft.text.*;
+import net.minecraft.util.Formatting;
 import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.text.*;
-import net.minecraft.util.text.event.ClickEvent;
 
 public class ClientInterop {
     public static void disconnectedFromRemoteServer() {
@@ -35,32 +35,32 @@ public class ClientInterop {
 
     public static boolean interceptChatMessage(String message) {
         if (message.startsWith("/bbor:")) {
-            ClientPlayNetHandler connection = Minecraft.getInstance().getConnection();
+            ClientPlayNetworkHandler connection = MinecraftClient.getInstance().getNetworkHandler();
             if (connection != null) {
-                CommandDispatcher<ISuggestionProvider> commandDispatcher = connection.getCommandDispatcher();
-                CommandSource commandSource = Minecraft.getInstance().player.getCommandSource();
+                CommandDispatcher<CommandSource> commandDispatcher = connection.getCommandDispatcher();
+                ServerCommandSource commandSource = MinecraftClient.getInstance().player.getCommandSource();
                 try {
                     commandDispatcher.execute(message.substring(1), commandSource);
                 } catch (CommandSyntaxException exception) {
-                    commandSource.sendErrorMessage(TextComponentUtils.toTextComponent(exception.getRawMessage()));
+                    commandSource.sendError(Texts.toText(exception.getRawMessage()));
                     if (exception.getInput() != null && exception.getCursor() >= 0) {
-                        ITextComponent suggestion = new StringTextComponent("")
-                                .applyTextStyle(TextFormatting.GRAY)
-                                .applyTextStyle(style -> style.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, message)));
+                        Text suggestion = new LiteralText("")
+                                .formatted(Formatting.GRAY)
+                                .styled(style -> style.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, message)));
                         int textLength = Math.min(exception.getInput().length(), exception.getCursor());
                         if (textLength > 10) {
-                            suggestion.appendText("...");
+                            suggestion.append("...");
                         }
 
-                        suggestion.appendText(exception.getInput().substring(Math.max(0, textLength - 10), textLength));
+                        suggestion.append(exception.getInput().substring(Math.max(0, textLength - 10), textLength));
                         if (textLength < exception.getInput().length()) {
-                            suggestion.appendSibling(new StringTextComponent(exception.getInput().substring(textLength))
-                                    .applyTextStyles(TextFormatting.RED, TextFormatting.UNDERLINE));
+                            suggestion.append(new LiteralText(exception.getInput().substring(textLength))
+                                    .formatted(Formatting.RED, Formatting.UNDERLINE));
                         }
 
-                        suggestion.appendSibling(new TranslationTextComponent("command.context.here")
-                                .applyTextStyles(TextFormatting.RED, TextFormatting.ITALIC));
-                        commandSource.sendErrorMessage(suggestion);
+                        suggestion.append(new TranslatableText("command.context.here")
+                                .formatted(Formatting.RED, Formatting.ITALIC));
+                        commandSource.sendError(suggestion);
                     }
                 }
             }
@@ -74,22 +74,22 @@ public class ClientInterop {
     }
 
     public static int getRenderDistanceChunks() {
-        return Minecraft.getInstance().gameSettings.renderDistanceChunks;
+        return MinecraftClient.getInstance().options.viewDistance;
     }
 
-    public static void handleSeedMessage(ITextComponent chatComponent) {
-        TypeHelper.doIfType(chatComponent, TranslationTextComponent.class, message -> {
+    public static void handleSeedMessage(Text chatComponent) {
+        TypeHelper.doIfType(chatComponent, TranslatableText.class, message -> {
             if (!message.getKey().equals("commands.seed.success")) return;
 
             try {
-                long seed = Long.parseLong(message.getFormatArgs()[0].toString());
+                long seed = Long.parseLong(message.getArgs()[0].toString());
                 SlimeChunkProvider.setSeed(seed);
             } catch (Exception ignored) {
             }
         });
     }
 
-    public static void registerClientCommands(CommandDispatcher<ISuggestionProvider> commandDispatcher) {
+    public static void registerClientCommands(CommandDispatcher<CommandSource> commandDispatcher) {
         SeedCommand.register(commandDispatcher);
         SpawningSphereCommand.register(commandDispatcher);
         CustomCommand.register(commandDispatcher);
@@ -103,7 +103,7 @@ public class ClientInterop {
 
     public static void saveLoaded(String fileName, long seed) {
         displayScreen(null);
-        Minecraft.getInstance().mouseHelper.grabMouse();
+        MinecraftClient.getInstance().mouse.lockCursor();
 
         clearStructures();
 
@@ -117,10 +117,10 @@ public class ClientInterop {
     }
 
     public static void displayScreen(Screen screen) {
-        Minecraft.getInstance().displayGuiScreen(screen);
+        MinecraftClient.getInstance().openScreen(screen);
     }
 
     public static long getGameTime() {
-        return Minecraft.getInstance().world.getGameTime();
+        return MinecraftClient.getInstance().world.getTime();
     }
 }
index 1d64707817d4b13abb1b7db7bd8bf68d75f8666e..270a29c147ddd4410fc7a1865361c350911a5220 100644 (file)
@@ -6,11 +6,11 @@ import com.irtimaled.bbor.client.config.Setting;
 import com.irtimaled.bbor.common.models.Coords;
 import net.minecraft.block.BlockState;
 import net.minecraft.block.Blocks;
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.biome.Biomes;
 import net.minecraft.world.gen.feature.DecoratedFeatureConfig;
-import net.minecraft.world.gen.feature.FlowersFeature;
+import net.minecraft.world.gen.feature.FlowerFeature;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -20,7 +20,7 @@ public class FlowerForestHelper {
     private static final Random random = new Random();
 
     private static final Map<BlockState, Setting<HexColor>> flowerColorMap = new HashMap<>();
-    private static final FlowersFeature flowersFeature;
+    private static final FlowerFeature flowersFeature;
 
     static {
         flowerColorMap.put(Blocks.DANDELION.getDefaultState(), ConfigManager.colorFlowerForestDandelion);
@@ -35,14 +35,14 @@ public class FlowerForestHelper {
         flowerColorMap.put(Blocks.CORNFLOWER.getDefaultState(), ConfigManager.colorFlowerForestCornflower);
         flowerColorMap.put(Blocks.LILY_OF_THE_VALLEY.getDefaultState(), ConfigManager.colorFlowerForestLilyOfTheValley);
 
-        DecoratedFeatureConfig config = (DecoratedFeatureConfig) Biomes.FLOWER_FOREST.getFlowers().get(0).config;
-        flowersFeature = (FlowersFeature) config.feature.feature;
+        DecoratedFeatureConfig config = (DecoratedFeatureConfig) Biomes.FLOWER_FOREST.getFlowerFeatures().get(0).config;
+        flowersFeature = (FlowerFeature) config.feature.feature;
     }
 
     public static Setting<HexColor> getFlowerColorAtPos(Coords coords) {
         int x = coords.getX();
         int z = coords.getZ();
-        BlockState blockState = flowersFeature.getRandomFlower(random, new BlockPos(x, coords.getY(), z));
+        BlockState blockState = flowersFeature.getFlowerToPlace(random, new BlockPos(x, coords.getY(), z));
         return flowerColorMap.get(blockState);
     }
 
@@ -51,6 +51,6 @@ public class FlowerForestHelper {
     }
 
     public static boolean canGrowFlower(int x, int y, int z) {
-        return Minecraft.getInstance().world.getBlockState(new BlockPos(x, y, z)).getBlock() == Blocks.GRASS_BLOCK;
+        return MinecraftClient.getInstance().world.getBlockState(new BlockPos(x, y, z)).getBlock() == Blocks.GRASS_BLOCK;
     }
 }
index 3b737e3d55cdd5f6298e68bce43e67fdafa131c4..f70c93c9a5e1074c6ab8d960283ee2bcee81fa2a 100644 (file)
@@ -1,27 +1,27 @@
 package com.irtimaled.bbor.client.interop;
 
-import net.minecraft.resources.IPackFinder;
-import net.minecraft.resources.IResourcePack;
-import net.minecraft.resources.ResourcePackInfo;
-import net.minecraft.resources.VanillaPack;
+import net.minecraft.resource.DefaultResourcePack;
+import net.minecraft.resource.ResourcePack;
+import net.minecraft.resource.ResourcePackProfile;
+import net.minecraft.resource.ResourcePackProvider;
 
 import java.util.Map;
 
-public class ModPackFinder implements IPackFinder {
+public class ModPackFinder implements ResourcePackProvider {
     private static final String BBOR = "bbor";
-    private final IResourcePack modPack;
+    private final ResourcePack modPack;
 
     public ModPackFinder() {
-        modPack = new VanillaPack(BBOR);
+        modPack = new DefaultResourcePack(BBOR);
     }
 
     @Override
-    public <T extends ResourcePackInfo> void addPackInfosToMap(Map<String, T> map, ResourcePackInfo.IFactory<T> factory) {
-        T resourcePackInfo = ResourcePackInfo.createResourcePack(BBOR,
+    public <T extends ResourcePackProfile> void register(Map<String, T> map, ResourcePackProfile.Factory<T> factory) {
+        T resourcePackInfo = ResourcePackProfile.of(BBOR,
                 true,
                 () -> this.modPack,
                 factory,
-                ResourcePackInfo.Priority.BOTTOM);
+                ResourcePackProfile.InsertionPosition.BOTTOM);
         if (resourcePackInfo != null) {
             map.put(BBOR, resourcePackInfo);
         }
index f7ab2f3de8736c56e7d19f89826660900db3acb2..d067a0b2f65dfb772d0d1f053457330c48274896 100644 (file)
@@ -3,21 +3,21 @@ package com.irtimaled.bbor.client.interop;
 import com.irtimaled.bbor.common.EventBus;
 import com.irtimaled.bbor.common.events.StructuresLoaded;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.nbt.CompoundNBT;
-import net.minecraft.nbt.ListNBT;
+import net.minecraft.nbt.CompoundTag;
+import net.minecraft.nbt.ListTag;
+import net.minecraft.structure.StructureManager;
+import net.minecraft.structure.StructurePiece;
+import net.minecraft.structure.StructureStart;
+import net.minecraft.util.math.BlockBox;
 import net.minecraft.util.math.ChunkPos;
-import net.minecraft.util.math.MutableBoundingBox;
+import net.minecraft.world.FeatureUpdater;
 import net.minecraft.world.IWorld;
+import net.minecraft.world.PersistentStateManager;
+import net.minecraft.world.WorldSaveHandler;
 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.DimensionSavedDataManager;
-import net.minecraft.world.storage.SaveHandler;
+import net.minecraft.world.gen.chunk.ChunkGenerator;
+import net.minecraft.world.storage.RegionBasedStorage;
 
 import java.io.File;
 import java.io.IOException;
@@ -27,12 +27,12 @@ class NBTStructureLoader {
     private final DimensionId dimensionId;
     private final Set<String> loadedChunks = new HashSet<>();
 
-    private LegacyStructureDataUtil legacyStructureDataUtil = null;
-    private SaveHandler saveHandler = null;
+    private FeatureUpdater legacyStructureDataUtil = null;
+    private WorldSaveHandler saveHandler = null;
     private File chunkSaveLocation = null;
     private ChunkLoader chunkLoader;
 
-    NBTStructureLoader(DimensionId dimensionId, SaveHandler saveHandler, File worldDirectory) {
+    NBTStructureLoader(DimensionId dimensionId, WorldSaveHandler saveHandler, File worldDirectory) {
         this.dimensionId = dimensionId;
         this.configure(saveHandler, worldDirectory);
     }
@@ -51,31 +51,31 @@ class NBTStructureLoader {
         this.chunkLoader = null;
     }
 
-    void configure(SaveHandler saveHandler, File worldDirectory) {
+    void configure(WorldSaveHandler saveHandler, File worldDirectory) {
         this.saveHandler = saveHandler;
         if (worldDirectory != null) {
-            this.chunkSaveLocation = new File(dimensionId.getDimensionType().getDirectory(worldDirectory), "region");
+            this.chunkSaveLocation = new File(dimensionId.getDimensionType().getSaveDirectory(worldDirectory), "region");
             this.chunkLoader = new ChunkLoader(this.chunkSaveLocation);
         }
     }
 
-    private LegacyStructureDataUtil getLegacyStructureDataUtil() {
+    private FeatureUpdater getLegacyStructureDataUtil() {
         if (this.legacyStructureDataUtil == null) {
-            File dataFolder = new File(DimensionType.OVERWORLD.getDirectory(this.saveHandler.getWorldDirectory()), "data");
-            this.legacyStructureDataUtil = LegacyStructureDataUtil.func_215130_a(dimensionId.getDimensionType(),
-                    new DimensionSavedDataManager(dataFolder, this.saveHandler.getFixer()));
+            File dataFolder = new File(DimensionType.OVERWORLD.getSaveDirectory(this.saveHandler.getWorldDir()), "data");
+            this.legacyStructureDataUtil = FeatureUpdater.create(dimensionId.getDimensionType(),
+                    new PersistentStateManager(dataFolder, this.saveHandler.getDataFixer()));
         }
         return this.legacyStructureDataUtil;
     }
 
-    private CompoundNBT loadStructureStarts(int chunkX, int chunkZ) {
+    private CompoundTag loadStructureStarts(int chunkX, int chunkZ) {
         try {
-            CompoundNBT compound = this.chunkLoader.readChunk(chunkX, chunkZ);
+            CompoundTag 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);
+                    compound = getLegacyStructureDataUtil().getUpdatedReferences(compound);
                 }
             }
             return compound.getCompound("Level").getCompound("Structures").getCompound("Starts");
@@ -89,12 +89,12 @@ class NBTStructureLoader {
 
         if (!loadedChunks.add(String.format("%s,%s", chunkX, chunkZ))) return;
 
-        CompoundNBT structureStarts = loadStructureStarts(chunkX, chunkZ);
-        if (structureStarts == null || structureStarts.size() == 0) return;
+        CompoundTag structureStarts = loadStructureStarts(chunkX, chunkZ);
+        if (structureStarts == null || structureStarts.getSize() == 0) return;
 
         Map<String, StructureStart> structureStartMap = new HashMap<>();
-        for (String key : structureStarts.keySet()) {
-            CompoundNBT compound = structureStarts.getCompound(key);
+        for (String key : structureStarts.getKeys()) {
+            CompoundTag compound = structureStarts.getCompound(key);
             if (compound.contains("BB")) {
                 structureStartMap.put(key, new SimpleStructureStart(compound));
             }
@@ -104,54 +104,54 @@ class NBTStructureLoader {
     }
 
     private static class SimpleStructureStart extends StructureStart {
-        SimpleStructureStart(CompoundNBT compound) {
+        SimpleStructureStart(CompoundTag compound) {
             super(null,
                     0,
                     0,
                     null,
-                    new MutableBoundingBox(compound.getIntArray("BB")),
+                    new BlockBox(compound.getIntArray("BB")),
                     0,
                     0);
 
-            ListNBT children = compound.getList("Children", 10);
+            ListTag children = compound.getList("Children", 10);
             for (int index = 0; index < children.size(); ++index) {
-                CompoundNBT child = children.getCompound(index);
-                if (child.contains("BB")) this.components.add(new SimpleStructurePiece(child));
+                CompoundTag child = children.getCompound(index);
+                if (child.contains("BB")) this.children.add(new SimpleStructurePiece(child));
             }
         }
 
         @Override
-        public void init(ChunkGenerator<?> chunkGenerator, TemplateManager templateManager, int i, int i1, Biome biome) {
+        public void initialize(ChunkGenerator<?> chunkGenerator, StructureManager structureManager, int i, int i1, Biome biome) {
 
         }
     }
 
     private static class SimpleStructurePiece extends StructurePiece {
-        SimpleStructurePiece(CompoundNBT compound) {
+        SimpleStructurePiece(CompoundTag compound) {
             super(null, compound);
         }
 
         @Override
-        protected void readAdditional(CompoundNBT compoundNBT) {
+        protected void toNbt(CompoundTag compoundTag) {
 
         }
 
         @Override
-        public boolean addComponentParts(IWorld iWorld, Random random, MutableBoundingBox mutableBoundingBox, ChunkPos chunkPos) {
+        public boolean generate(IWorld iWorld, Random random, BlockBox blockBox, ChunkPos chunkPos) {
             return false;
         }
     }
 
     private static class ChunkLoader {
-        private final RegionFileCache regionFileCache;
+        private final RegionBasedStorage regionFileCache;
 
         public ChunkLoader(File file) {
-            this.regionFileCache = new RegionFileCache(file) {
+            this.regionFileCache = new RegionBasedStorage(file) {
             };
         }
 
-        public CompoundNBT readChunk(int chunkX, int chunkZ) throws IOException {
-            return regionFileCache.readChunk(new ChunkPos(chunkX, chunkZ));
+        public CompoundTag readChunk(int chunkX, int chunkZ) throws IOException {
+            return regionFileCache.getTagAt(new ChunkPos(chunkX, chunkZ));
         }
 
         public void close() throws IOException {
index fd392aed12490bec950fce0bdb8356962806d5de..9f7f54ebc9339cfb66985e1170dbc3fa411c88af 100644 (file)
@@ -2,9 +2,9 @@ package com.irtimaled.bbor.client.interop;
 
 import com.irtimaled.bbor.client.Player;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.client.Minecraft;
-import net.minecraft.world.storage.SaveFormat;
-import net.minecraft.world.storage.SaveHandler;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.world.WorldSaveHandler;
+import net.minecraft.world.level.storage.LevelStorage;
 
 import java.io.File;
 import java.util.HashMap;
@@ -12,14 +12,14 @@ import java.util.Map;
 
 public class SaveGameStructureLoader {
     private static final Map<DimensionId, NBTStructureLoader> nbtStructureLoaders = new HashMap<>();
-    private static SaveHandler saveHandler = null;
+    private static WorldSaveHandler saveHandler = null;
     private static File worldDirectory = null;
 
     static void loadSaveGame(String fileName) {
-        Minecraft minecraft = Minecraft.getInstance();
-        SaveFormat saveLoader = minecraft.getSaveLoader();
-        saveHandler = saveLoader.getSaveLoader(fileName, null);
-        worldDirectory = saveLoader.func_215781_c().resolve(fileName).toFile();
+        MinecraftClient minecraft = MinecraftClient.getInstance();
+        LevelStorage saveLoader = minecraft.getLevelStorage();
+        saveHandler = saveLoader.createSaveHandler(fileName, null);
+        worldDirectory = saveLoader.getSavesDirectory().resolve(fileName).toFile();
 
         for (DimensionId dimensionId : nbtStructureLoaders.keySet()) {
             NBTStructureLoader dimensionProcessor = getNBTStructureLoader(dimensionId);
index 016d5c3175759be137767fd1068b5737b2125d83..7672372b359eced4956e905a4279b8217b98b7bd 100644 (file)
@@ -3,20 +3,20 @@ package com.irtimaled.bbor.client.interop;
 import com.irtimaled.bbor.common.models.Coords;
 import net.minecraft.block.Block;
 import net.minecraft.block.BlockState;
-import net.minecraft.client.Minecraft;
-import net.minecraft.entity.EntityClassification;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.entity.EntityCategory;
 import net.minecraft.entity.EntityType;
-import net.minecraft.tags.BlockTags;
-import net.minecraft.util.Direction;
+import net.minecraft.tag.BlockTags;
 import net.minecraft.util.math.BlockPos;
-import net.minecraft.util.math.shapes.VoxelShape;
+import net.minecraft.util.math.Direction;
+import net.minecraft.util.shape.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);
+    private static final EntityType entityType = EntityType.Builder.create(EntityCategory.MONSTER)
+            .setDimensions(0f, 0f).disableSaving().build(null);
 
     public static void findSpawnableBlocks(Coords coords, int width, int height, BlockProcessor blockProcessor) {
         int blockX = coords.getX();
@@ -31,7 +31,7 @@ public class SpawnableBlocksHelper {
         int minY = Math.max(1, blockY - height);
         int maxY = Math.min(255, blockY + height);
 
-        World world = Minecraft.getInstance().world;
+        World world = MinecraftClient.getInstance().world;
         for (int x = minX; x < maxX; x++) {
             for (int z = minZ; z < maxZ; z++) {
                 if (isBiomeHostileSpawnProof(world, new BlockPos(x, 1, z))) continue;
@@ -51,19 +51,19 @@ public class SpawnableBlocksHelper {
 
     static boolean isBiomeHostileSpawnProof(World world, BlockPos pos) {
         Biome biome = world.getBiome(pos);
-        return biome.getSpawningChance() == 0 ||
-                biome.getSpawns(EntityClassification.MONSTER).isEmpty();
+        return biome.getMaxSpawnLimit() == 0 ||
+                biome.getEntitySpawnList(EntityCategory.MONSTER).isEmpty();
     }
 
     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) &&
-                collisionShape.getEnd(Direction.Axis.Y) <= 0 &&
+        return spawnBlockState.allowsSpawning(world, pos.down(), isNether ? EntityType.ZOMBIE_PIGMAN : entityType) &&
+                !Block.isFaceFullSquare(collisionShape, Direction.UP) &&
+                !upperBlockState.emitsRedstonePower() &&
+                !upperBlockState.matches(BlockTags.RAILS) &&
+                collisionShape.getMaximum(Direction.Axis.Y) <= 0 &&
                 upperBlockState.getFluidState().isEmpty() &&
-                (isNether || world.getLightFor(LightType.BLOCK, pos) <= 7);
+                (isNether || world.getLightLevel(LightType.BLOCK, pos) <= 7);
     }
 }
index 856e4b89797a37e1281ceb0023e72aa9dfb8eb43..706d38e9befe393ee4e917f6967a54439982f6b6 100644 (file)
@@ -4,7 +4,7 @@ import com.irtimaled.bbor.client.models.BoundingBoxSpawningSphere;
 import com.irtimaled.bbor.client.models.Point;
 import com.irtimaled.bbor.common.models.Coords;
 import net.minecraft.block.BlockState;
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 import net.minecraft.util.math.BlockPos;
 import net.minecraft.world.World;
 
@@ -22,7 +22,7 @@ public class SpawningSphereHelper {
         int minY = Math.max(1, blockY - height);
         int maxY = Math.min(255, blockY + height);
 
-        World world = Minecraft.getInstance().world;
+        World world = MinecraftClient.getInstance().world;
         for (int x = minX; x < maxX; x++) {
             for (int z = minZ; z < maxZ; z++) {
                 double closestX = x + 0.5D;
index 75d7fc0f9b1b1fae8a8ac8f4b3b10b9534841b71..f778d31c6420a2581e8fd77007dfc20fd5b53c85 100644 (file)
@@ -2,8 +2,8 @@ package com.irtimaled.bbor.client.interop;
 
 import com.irtimaled.bbor.common.TypeHelper;
 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
-import net.minecraft.client.Minecraft;
-import net.minecraft.tileentity.TileEntity;
+import net.minecraft.block.entity.BlockEntity;
+import net.minecraft.client.MinecraftClient;
 
 import java.util.Collection;
 import java.util.HashSet;
@@ -11,11 +11,11 @@ import java.util.Set;
 import java.util.function.Function;
 
 public class TileEntitiesHelper {
-    public static <T extends TileEntity, S extends AbstractBoundingBox> Iterable<S> map(Class<T> clazz, Function<T, S> map) {
-        Collection<TileEntity> tileEntities = Minecraft.getInstance().world.loadedTileEntityList;
+    public static <T extends BlockEntity, S extends AbstractBoundingBox> Iterable<S> map(Class<T> clazz, Function<T, S> map) {
+        Collection<BlockEntity> tileEntities = MinecraftClient.getInstance().world.blockEntities;
 
         Set<S> results = new HashSet<>();
-        for (TileEntity tileEntity : tileEntities) {
+        for (BlockEntity tileEntity : tileEntities) {
             T typed = TypeHelper.as(tileEntity, clazz);
             if (typed == null) {
                 continue;
index 49008072ccce3272c1e4652d4f538048552d5e0f..ba13fcfeb3e557305fbeb79c875bb6f7631d7317 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.client.keyboard;
 
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.client.util.InputMappings;
+import net.minecraft.client.options.KeyBinding;
+import net.minecraft.client.util.InputUtil;
 
 class CustomKeyBinding extends KeyBinding {
     private final Key key;
@@ -12,8 +12,8 @@ class CustomKeyBinding extends KeyBinding {
     }
 
     @Override
-    public void bind(InputMappings.Input input) {
-        super.bind(input);
+    public void setKeyCode(InputUtil.KeyCode input) {
+        super.setKeyCode(input);
         int keyCode = input.getKeyCode();
         key.updateKeyCode(keyCode);
     }
index cdcec3dbc426e81146cbd36cf6cee7804610579f..6d6aefd065ab6f0753f6d81f7bfd5695df1a370d 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor.client.keyboard;
 
-import net.minecraft.client.util.InputMappings;
+import net.minecraft.client.util.InputUtil;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -78,7 +78,7 @@ public class Key {
     }
 
     public Key register(String keyName) {
-        InputMappings.Input input = InputMappings.getInputByName(keyName);
+        InputUtil.KeyCode input = InputUtil.fromName(keyName);
         Key key = new Key(input.getKeyCode());
         subKeys.add(key);
         return key;
index 52b3f83d4bdb39997ab121df0fa0d5dded57f372..2e7d30da0d438b5fcf861fb8b7caeaaee3bc2342 100644 (file)
@@ -1,27 +1,27 @@
 package com.irtimaled.bbor.client.keyboard;
 
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.settings.KeyBinding;
-import net.minecraft.client.util.InputMappings;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.options.KeyBinding;
+import net.minecraft.client.util.InputUtil;
 import org.lwjgl.glfw.GLFW;
 
 import java.util.HashSet;
 import java.util.Set;
 
 public class KeyListener {
-    private static final Minecraft minecraft = Minecraft.getInstance();
+    private static final MinecraftClient minecraft = MinecraftClient.getInstance();
     private static long mainWindowHandle;
     private static final Set<Key> keys = new HashSet<>();
     private static final Set<CustomKeyBinding> keyBindings = new HashSet<>();
     public static final String Category = "Bounding Box Outline Reloaded";
 
     public static void init() {
-        mainWindowHandle = minecraft.mainWindow.getHandle();
+        mainWindowHandle = minecraft.window.getHandle();
         GLFW.glfwSetKeyCallback(mainWindowHandle, KeyListener::onKeyEvent);
     }
 
     public static Key register(String description, String keyName) {
-        InputMappings.Input input = InputMappings.getInputByName(keyName);
+        InputUtil.KeyCode input = InputUtil.fromName(keyName);
         CustomKeyBinding keyBinding = new CustomKeyBinding(description, input.getKeyCode());
         keyBindings.add(keyBinding);
 
@@ -35,10 +35,10 @@ public class KeyListener {
         if (windowHandle == mainWindowHandle &&
                 minecraft.currentScreen == null &&
                 keyCode != -1 &&
-                !InputMappings.isKeyDown(mainWindowHandle, 292) &&
+                !InputUtil.isKeyPressed(mainWindowHandle, 292) &&
                 handleKeyEvent(keyCode, isPressed))
             return;
-        minecraft.keyboardListener.onKeyEvent(windowHandle, keyCode, scanCode, action, modifiers);
+        minecraft.keyboard.onKey(windowHandle, keyCode, scanCode, action, modifiers);
     }
 
     private static boolean handleKeyEvent(int keyCode, boolean isPressed) {
index f0314964487a64fa3969374ab21746fb3e47b9b3..8b8cb0e31af28a0496d512a6e73e1e81c1fd10e6 100644 (file)
@@ -6,7 +6,8 @@ import com.irtimaled.bbor.client.models.BoundingBoxBeacon;
 import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.tileentity.BeaconTileEntity;
+import net.minecraft.block.entity.BeaconBlockEntity;
+
 
 public class BeaconProvider implements IBoundingBoxProvider<BoundingBoxBeacon> {
     @Override
@@ -16,8 +17,8 @@ public class BeaconProvider implements IBoundingBoxProvider<BoundingBoxBeacon> {
 
     @Override
     public Iterable<BoundingBoxBeacon> get(DimensionId dimensionId) {
-        return TileEntitiesHelper.map(BeaconTileEntity.class, beacon -> {
-            int levels = beacon.getLevels();
+        return TileEntitiesHelper.map(BeaconBlockEntity.class, beacon -> {
+            int levels = beacon.getLevel();
             Coords coords = new Coords(beacon.getPos());
             return BoundingBoxBeacon.from(coords, levels);
         });
index 38de01f09d40f322ce2914144ef82f8d0880eb37..c15e0e232e1c20ffa692b0a8f8955f3987d2f0db 100644 (file)
@@ -7,15 +7,15 @@ import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.ReflectionHelper;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.tileentity.ConduitTileEntity;
+import net.minecraft.block.entity.ConduitBlockEntity;
 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<ConduitTileEntity, List<BlockPos>> blocksFetcher =
-            ReflectionHelper.getPrivateFieldGetter(ConduitTileEntity.class, List.class, BlockPos.class);
+    private static final Function<ConduitBlockEntity, List<BlockPos>> blocksFetcher =
+            ReflectionHelper.getPrivateFieldGetter(ConduitBlockEntity.class, List.class, BlockPos.class);
 
     @Override
     public boolean canProvide(DimensionId dimensionId) {
@@ -24,7 +24,7 @@ public class ConduitProvider implements IBoundingBoxProvider<BoundingBoxConduit>
 
     @Override
     public Iterable<BoundingBoxConduit> get(DimensionId dimensionId) {
-        return TileEntitiesHelper.map(ConduitTileEntity.class, conduit -> {
+        return TileEntitiesHelper.map(ConduitBlockEntity.class, conduit -> {
             List<BlockPos> blocks = blocksFetcher.apply(conduit);
             if (blocks == null) return null;
 
index 3bc7bdc0434be8c12c8447855dbb468aa9f3f142..e704d8d0be92db8b4ffc68ce70cebbffa8ca2683 100644 (file)
@@ -17,7 +17,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 public class FlowerForestProvider implements IBoundingBoxProvider<BoundingBoxFlowerForest>, ICachingProvider {
-    public static final int FLOWER_FOREST_BIOME_ID = Registry.BIOME.getId(Biomes.FLOWER_FOREST);
+    public static final int FLOWER_FOREST_BIOME_ID = Registry.BIOME.getRawId(Biomes.FLOWER_FOREST);
     private static Coords lastPlayerCoords = null;
     private static Integer lastRenderDistance = null;
     private static Map<Coords, BoundingBoxFlowerForest> lastBoundingBoxes = new HashMap<>();
index 12eef54ff37f524a6b0dd14f5cb1d5503117c8e5..5079aa048524b643c7d586e5de3541ef651081dc 100644 (file)
@@ -6,7 +6,7 @@ import com.irtimaled.bbor.client.models.BoundingBoxMobSpawner;
 import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.tileentity.MobSpawnerTileEntity;
+import net.minecraft.block.entity.MobSpawnerBlockEntity;
 
 public class MobSpawnerProvider implements IBoundingBoxProvider<BoundingBoxMobSpawner> {
     @Override
@@ -16,7 +16,7 @@ public class MobSpawnerProvider implements IBoundingBoxProvider<BoundingBoxMobSp
 
     @Override
     public Iterable<BoundingBoxMobSpawner> get(DimensionId dimensionId) {
-        return TileEntitiesHelper.map(MobSpawnerTileEntity.class, spawner -> {
+        return TileEntitiesHelper.map(MobSpawnerBlockEntity.class, spawner -> {
             Coords coords = new Coords(spawner.getPos());
             return BoundingBoxMobSpawner.from(coords);
         });
index a8d0302e0692adaa36afbb56cb6b9dbb7a3360f3..ca4b5ca5a38dd1c18420b5232a17f890c4dcc419 100644 (file)
@@ -8,7 +8,7 @@ import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.MathHelper;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.util.SharedSeedRandom;
+import net.minecraft.world.gen.ChunkRandom;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -23,7 +23,7 @@ public class SlimeChunkProvider implements IBoundingBoxProvider<BoundingBoxSlime
     }
 
     private static boolean isSlimeChunk(int chunkX, int chunkZ) {
-        return SharedSeedRandom.seedSlimeChunk(chunkX, chunkZ,seed, 987234911L).nextInt(10) == 0;
+        return ChunkRandom.create(chunkX, chunkZ, seed, 987234911L).nextInt(10) == 0;
     }
 
     public void clearCache() {
index 462bf6ef29b96d40a000809ce6290aaba4113ea3..b28b0e1a04029f51451bcdcd2e6270ab50c80fc2 100644 (file)
@@ -8,13 +8,13 @@ import com.irtimaled.bbor.client.models.BoundingBoxSpawnableBlocks;
 import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.MathHelper;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 
 import java.util.HashSet;
 import java.util.Set;
 
 public class SpawnableBlocksProvider implements IBoundingBoxProvider<BoundingBoxSpawnableBlocks>, ICachingProvider {
-    public static final Minecraft minecraft = Minecraft.getInstance();
+    public static final MinecraftClient minecraft = MinecraftClient.getInstance();
     private static Long lastGameTime = null;
 
     private static Set<BoundingBoxSpawnableBlocks> lastBoundingBox = null;
@@ -38,7 +38,7 @@ public class SpawnableBlocksProvider implements IBoundingBoxProvider<BoundingBox
 
     @Override
     public Iterable<BoundingBoxSpawnableBlocks> get(DimensionId dimensionId) {
-        long gameTime = minecraft.world.getGameTime();
+        long gameTime = minecraft.world.getTime();
         if (lastBoundingBox == null || (!((Long) gameTime).equals(lastGameTime) && gameTime % 2L == 0L)) {
             lastGameTime = gameTime;
             lastBoundingBox = getSpawnableBlocks();
index d9782fa5a4c61ed9856c1693d09b6732a4e580fe..ec0ee309ea9a71256541a8d20d98944b11e8b931 100644 (file)
@@ -10,13 +10,13 @@ import com.irtimaled.bbor.client.models.Point;
 import com.irtimaled.bbor.common.BoundingBoxType;
 import com.irtimaled.bbor.common.MathHelper;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 
 import java.util.HashSet;
 import java.util.Set;
 
 public class SpawningSphereProvider implements IBoundingBoxProvider<BoundingBoxSpawningSphere>, ICachingProvider {
-    public static final Minecraft minecraft = Minecraft.getInstance();
+    public static final MinecraftClient minecraft = MinecraftClient.getInstance();
     private static Long lastGameTime = null;
 
     private static Set<BoundingBoxSpawningSphere> lastBoundingBox = null;
@@ -74,7 +74,7 @@ public class SpawningSphereProvider implements IBoundingBoxProvider<BoundingBoxS
 
     @Override
     public Iterable<BoundingBoxSpawningSphere> get(DimensionId dimensionId) {
-        long gameTime = minecraft.world.getGameTime();
+        long gameTime = minecraft.world.getTime();
         if (lastBoundingBox == null || (!((Long) gameTime).equals(lastGameTime) && gameTime % 2L == 0L)) {
             lastGameTime = gameTime;
             lastBoundingBox = getSpawningSphere();
index 26f2279f645b928f30977c1dbaad818b51401d9f..907c0a917ca3f5d389f9e42dc1c57d9206c20120 100644 (file)
@@ -4,8 +4,8 @@ import com.irtimaled.bbor.client.config.ConfigManager;
 import com.irtimaled.bbor.client.models.Point;
 import com.irtimaled.bbor.common.MathHelper;
 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.font.TextRenderer;
 
 import java.awt.*;
 import java.util.function.Supplier;
@@ -121,14 +121,14 @@ public abstract class AbstractRenderer<T extends AbstractBoundingBox> {
     }
 
     void renderText(OffsetPoint offsetPoint, String... texts) {
-        FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
+        TextRenderer fontRenderer = MinecraftClient.getInstance().textRenderer;
 
         RenderHelper.beforeRenderFont(offsetPoint);
-        float top = -(fontRenderer.FONT_HEIGHT * texts.length) / 2f;
+        float top = -(fontRenderer.fontHeight * texts.length) / 2f;
         for (String text : texts) {
             float left = fontRenderer.getStringWidth(text) / 2f;
-            fontRenderer.drawString(text, -left, top, -1);
-            top += fontRenderer.FONT_HEIGHT;
+            fontRenderer.draw(text, -left, top, -1);
+            top += fontRenderer.fontHeight;
         }
         RenderHelper.afterRenderFont();
     }
index 84252260ba42b1f7d81aaf83d19cee125212fee0..c57de9a6ffe32d37e423bc875425c33502872626 100644 (file)
@@ -2,7 +2,7 @@ package com.irtimaled.bbor.client.renderers;
 
 import com.irtimaled.bbor.client.config.ConfigManager;
 import com.mojang.blaze3d.platform.GlStateManager;
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 import org.lwjgl.opengl.GL11;
 
 public class RenderHelper {
@@ -20,7 +20,7 @@ public class RenderHelper {
         enableDepthTest();
 
         if (ConfigManager.alwaysVisible.get()) {
-            GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC);
+            GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT, MinecraftClient.IS_SYSTEM_MAC);
         }
     }
 
index eb470b628bb4b31bbcdbf5fcba787c9619672981..806731a522b72de0a56ec6e38c05f30affb239fc 100644 (file)
@@ -1,10 +1,10 @@
 package com.irtimaled.bbor.client.renderers;
 
 import com.irtimaled.bbor.client.Camera;
-import net.minecraft.client.renderer.BufferBuilder;
-import net.minecraft.client.renderer.Tessellator;
-import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
-import net.minecraft.client.renderer.vertex.VertexFormat;
+import net.minecraft.client.render.BufferBuilder;
+import net.minecraft.client.render.Tessellator;
+import net.minecraft.client.render.VertexFormat;
+import net.minecraft.client.render.VertexFormats;
 
 import java.awt.*;
 
@@ -12,23 +12,23 @@ public class Renderer {
     private final int glMode;
 
     static Renderer startLines() {
-        return new Renderer(RenderHelper.LINES, DefaultVertexFormats.POSITION_COLOR);
+        return new Renderer(RenderHelper.LINES, VertexFormats.POSITION_COLOR);
     }
 
     static Renderer startLineLoop() {
-        return new Renderer(RenderHelper.LINE_LOOP, DefaultVertexFormats.POSITION_COLOR);
+        return new Renderer(RenderHelper.LINE_LOOP, VertexFormats.POSITION_COLOR);
     }
 
     static Renderer startQuads() {
-        return new Renderer(RenderHelper.QUADS, DefaultVertexFormats.POSITION_COLOR);
+        return new Renderer(RenderHelper.QUADS, VertexFormats.POSITION_COLOR);
     }
 
     static Renderer startPoints() {
-        return new Renderer(RenderHelper.POINTS, DefaultVertexFormats.POSITION_COLOR);
+        return new Renderer(RenderHelper.POINTS, VertexFormats.POSITION_COLOR);
     }
 
     public static Renderer startTextured() {
-        return new Renderer(RenderHelper.QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
+        return new Renderer(RenderHelper.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
     }
 
     private static final Tessellator tessellator = new Tessellator(2097152);
@@ -90,17 +90,17 @@ public class Renderer {
 
     public void render() {
         if (glMode == RenderHelper.QUADS) {
-            bufferBuilder.sortVertexData((float) Camera.getX(), (float) Camera.getY(), (float) Camera.getZ());
+            bufferBuilder.sortQuads((float) Camera.getX(), (float) Camera.getY(), (float) Camera.getZ());
         }
         tessellator.draw();
     }
 
     private void pos(double x, double y, double z) {
-        bufferBuilder.pos(x, y, z);
+        bufferBuilder.vertex(x, y, z);
     }
 
     private void tex(double u, double v) {
-        bufferBuilder.tex(u, v);
+        bufferBuilder.texture(u, v);
     }
 
     private void color() {
@@ -108,6 +108,6 @@ public class Renderer {
     }
 
     private void end() {
-        bufferBuilder.endVertex();
+        bufferBuilder.next();
     }
 }
index 1b9e555b48e79e55af859f0099819e0a8cc39e8e..1c07bbc2e78f7141305d7bde82dab534bb027ed2 100644 (file)
@@ -7,7 +7,7 @@ import com.irtimaled.bbor.client.config.ConfigManager;
 import com.irtimaled.bbor.client.models.BoundingBoxSpawningSphere;
 import com.irtimaled.bbor.client.models.Point;
 import com.irtimaled.bbor.common.BoundingBoxType;
-import net.minecraft.client.resources.I18n;
+import net.minecraft.client.resource.language.I18n;
 
 import java.awt.*;
 
@@ -27,9 +27,9 @@ public class SpawningSphereRenderer extends AbstractRenderer<BoundingBoxSpawning
 
         Integer spawnableSpacesCount = boundingBox.getSpawnableSpacesCount();
         if (spawnableSpacesCount != null) {
-            renderText(sphereCenter, I18n.format("bbor.renderer.spawningSphere.spawnable"),
+            renderText(sphereCenter, I18n.translate("bbor.renderer.spawningSphere.spawnable"),
                     spawnableSpacesCount == 0 ?
-                            I18n.format("bbor.renderer.spawningSphere.none") :
+                            I18n.translate("bbor.renderer.spawningSphere.none") :
                             String.format("%,d", spawnableSpacesCount));
         }
         renderSphere(point, BoundingBoxSpawningSphere.SAFE_RADIUS, safeAreaColor);
index 25e6c57dfdefc4edc2e873d0283fcb37a9440414..b63e0ebdf033040cd71cd50af270c5e3f2dd49ec 100644 (file)
@@ -3,9 +3,9 @@ package com.irtimaled.bbor.common;
 import com.irtimaled.bbor.common.models.AbstractBoundingBox;
 import com.irtimaled.bbor.common.models.BoundingBoxCuboid;
 import com.irtimaled.bbor.common.models.Coords;
-import net.minecraft.util.math.MutableBoundingBox;
-import net.minecraft.world.gen.feature.structure.StructurePiece;
-import net.minecraft.world.gen.feature.structure.StructureStart;
+import net.minecraft.structure.StructurePiece;
+import net.minecraft.structure.StructureStart;
+import net.minecraft.util.math.BlockBox;
 
 import java.util.HashSet;
 import java.util.Map;
@@ -28,20 +28,20 @@ class StructureProcessor {
         StructureStart structureStart = structureMap.get(type.getName());
         if (structureStart == null) return;
 
-        MutableBoundingBox bb = structureStart.getBoundingBox();
+        BlockBox bb = structureStart.getBoundingBox();
         if (bb == null) return;
 
         AbstractBoundingBox boundingBox = buildStructure(bb, type);
         if (boundingBoxCache.isCached(boundingBox)) return;
 
         Set<AbstractBoundingBox> structureBoundingBoxes = new HashSet<>();
-        for (StructurePiece structureComponent : structureStart.getComponents()) {
+        for (StructurePiece structureComponent : structureStart.getChildren()) {
             structureBoundingBoxes.add(buildStructure(structureComponent.getBoundingBox(), type));
         }
         boundingBoxCache.addBoundingBoxes(boundingBox, structureBoundingBoxes);
     }
 
-    private AbstractBoundingBox buildStructure(MutableBoundingBox bb, BoundingBoxType type) {
+    private AbstractBoundingBox buildStructure(BlockBox bb, BoundingBoxType type) {
         Coords min = new Coords(bb.minX, bb.minY, bb.minZ);
         Coords max = new Coords(bb.maxX, bb.maxY, bb.maxZ);
         return BoundingBoxCuboid.from(min, max, type);
index 05a5b21a9a3b9e8f02c236a78ddc1dd407017401..1d03c50ab9343059d071b3c235c1b6502e841839 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.common.events;
 
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.world.gen.feature.structure.StructureStart;
+import net.minecraft.structure.StructureStart;
 
 import java.util.Map;
 
index 6a84aa81d722c789ba038c7082204df85bc6b52f..f96d4d7a7f5020a10e357cdf289de730dabe10ac 100644 (file)
@@ -1,8 +1,8 @@
 package com.irtimaled.bbor.common.events;
 
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.world.server.ServerWorld;
-import net.minecraft.world.storage.WorldInfo;
+import net.minecraft.server.world.ServerWorld;
+import net.minecraft.world.level.LevelProperties;
 
 public class WorldLoaded {
     private final DimensionId dimensionId;
@@ -11,7 +11,7 @@ public class WorldLoaded {
     private final int spawnZ;
 
     public WorldLoaded(ServerWorld world) {
-        WorldInfo info = world.getWorldInfo();
+        LevelProperties info = world.getLevelProperties();
         this.dimensionId = DimensionId.from(world.getDimension().getType());
         this.seed = info.getSeed();
         this.spawnX = info.getSpawnX();
index b5c1eab084e60c7b816fc28fc2a1cacbf3e25245..879eba111af42c71cfc1516aceb6064174f76c5b 100644 (file)
@@ -4,18 +4,18 @@ import com.irtimaled.bbor.common.EventBus;
 import com.irtimaled.bbor.common.events.*;
 import com.irtimaled.bbor.common.models.DimensionId;
 import com.irtimaled.bbor.common.models.ServerPlayer;
-import net.minecraft.entity.player.ServerPlayerEntity;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.network.play.ServerPlayNetHandler;
-import net.minecraft.world.chunk.Chunk;
-import net.minecraft.world.gen.feature.structure.StructureStart;
-import net.minecraft.world.server.ServerWorld;
+import net.minecraft.network.ClientConnection;
+import net.minecraft.server.network.ServerPlayNetworkHandler;
+import net.minecraft.server.network.ServerPlayerEntity;
+import net.minecraft.server.world.ServerWorld;
+import net.minecraft.structure.StructureStart;
+import net.minecraft.world.chunk.WorldChunk;
 
 import java.util.Collection;
 import java.util.Map;
 
 public class CommonInterop {
-    public static void chunkLoaded(Chunk chunk) {
+    public static void chunkLoaded(WorldChunk chunk) {
         DimensionId dimensionId = DimensionId.from(chunk.getWorld().getDimension().getType());
         Map<String, StructureStart> structures = chunk.getStructureStarts();
         if (structures.size() > 0) EventBus.publish(new StructuresLoaded(structures, dimensionId));
@@ -36,11 +36,11 @@ public class CommonInterop {
     }
 
     public static void playerLoggedIn(ServerPlayerEntity player) {
-        ServerPlayNetHandler connection = player.connection;
+        ServerPlayNetworkHandler connection = player.networkHandler;
         if (connection == null) return;
 
-        NetworkManager networkManager = connection.netManager;
-        if (networkManager.isLocalChannel()) return;
+        ClientConnection networkManager = connection.connection;
+        if (networkManager.isLocal()) return;
 
         EventBus.publish(new PlayerLoggedIn(new ServerPlayer(player)));
     }
index a34b7044320bd45a02737ba372466e9c88e9d37e..2bf61c4d2344d532990bd83a86013da6ce313ef6 100644 (file)
@@ -45,7 +45,7 @@ public class AddBoundingBox {
         if (name.equals(NAME)) return reader.readDimensionId();
 
         int dimensionRawId = reader.readVarInt();
-        DimensionType dimensionType = DimensionType.getById(dimensionRawId);
+        DimensionType dimensionType = DimensionType.byRawId(dimensionRawId);
         return DimensionId.from(dimensionType);
     }
 }
index c94b315009fd91944a71f6bbe8b038a4f5c4ed79..831676ca56cd3c45e7ab9d9636c716dec8a527e7 100644 (file)
@@ -3,40 +3,40 @@ package com.irtimaled.bbor.common.messages;
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.DimensionId;
 import io.netty.buffer.Unpooled;
-import net.minecraft.network.IPacket;
-import net.minecraft.network.PacketBuffer;
-import net.minecraft.network.play.client.CCustomPayloadPacket;
-import net.minecraft.network.play.server.SCustomPayloadPlayPacket;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.network.Packet;
+import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
+import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
+import net.minecraft.util.Identifier;
+import net.minecraft.util.PacketByteBuf;
 
 import java.util.HashMap;
 import java.util.Map;
 import java.util.function.BiFunction;
 
 public class PayloadBuilder {
-    private static final Map<String, ResourceLocation> packetNames = new HashMap<>();
+    private static final Map<String, Identifier> packetNames = new HashMap<>();
 
     static PayloadBuilder clientBound(String name) {
-        return new PayloadBuilder(packetNames.computeIfAbsent(name, ResourceLocation::new), SCustomPayloadPlayPacket::new);
+        return new PayloadBuilder(packetNames.computeIfAbsent(name, Identifier::new), CustomPayloadS2CPacket::new);
     }
 
     static PayloadBuilder serverBound(String name) {
-        return new PayloadBuilder(packetNames.computeIfAbsent(name, ResourceLocation::new), CCustomPayloadPacket::new);
+        return new PayloadBuilder(packetNames.computeIfAbsent(name, Identifier::new), CustomPayloadC2SPacket::new);
     }
 
-    private final ResourceLocation name;
-    private final BiFunction<ResourceLocation, PacketBuffer, IPacket<?>> packetBuilder;
-    private final PacketBuffer buffer;
+    private final Identifier name;
+    private final BiFunction<Identifier, PacketByteBuf, Packet<?>> packetBuilder;
+    private final PacketByteBuf buffer;
 
-    private PayloadBuilder(ResourceLocation name, BiFunction<ResourceLocation, PacketBuffer, IPacket<?>> packetBuilder) {
+    private PayloadBuilder(Identifier name, BiFunction<Identifier, PacketByteBuf, Packet<?>> packetBuilder) {
         this.name = name;
-        this.buffer = new PacketBuffer(Unpooled.buffer());
+        this.buffer = new PacketByteBuf(Unpooled.buffer());
         this.packetBuilder = packetBuilder;
     }
 
-    private IPacket<?> packet;
+    private Packet<?> packet;
 
-    public IPacket<?> build() {
+    public Packet<?> build() {
         if (packet == null)
             packet = packetBuilder.apply(name, buffer);
         return packet;
@@ -73,7 +73,7 @@ public class PayloadBuilder {
     }
 
     public PayloadBuilder writeDimensionId(DimensionId dimensionId) {
-        buffer.writeResourceLocation(dimensionId.getValue());
+        buffer.writeIdentifier(dimensionId.getValue());
         packet = null;
         return this;
     }
index 22974b7a0f5250173eccdedad3797bb0d9830561..22f3b707a722e6738a4461593876491acd455e20 100644 (file)
@@ -2,12 +2,12 @@ package com.irtimaled.bbor.common.messages;
 
 import com.irtimaled.bbor.common.models.Coords;
 import com.irtimaled.bbor.common.models.DimensionId;
-import net.minecraft.network.PacketBuffer;
+import net.minecraft.util.PacketByteBuf;
 
 public class PayloadReader {
-    private final PacketBuffer buffer;
+    private final PacketByteBuf buffer;
 
-    public PayloadReader(PacketBuffer buffer) {
+    public PayloadReader(PacketByteBuf buffer) {
         this.buffer = buffer;
     }
 
@@ -43,6 +43,6 @@ public class PayloadReader {
     }
 
     DimensionId readDimensionId() {
-        return DimensionId.from(buffer.readResourceLocation());
+        return DimensionId.from(buffer.readIdentifier());
     }
 }
index fd81a223922a4dcb58880d7cc3d72eb6ff4a573b..fb76702f920c976f6e1f93859af0699761a43577 100644 (file)
@@ -1,37 +1,37 @@
 package com.irtimaled.bbor.common.models;
 
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.util.Identifier;
 import net.minecraft.world.dimension.DimensionType;
 
 import java.util.HashMap;
 import java.util.Map;
 
 public class DimensionId {
-    private static final Map<ResourceLocation, DimensionId> dimensionIdMap = new HashMap<>();
+    private static final Map<Identifier, DimensionId> dimensionIdMap = new HashMap<>();
 
     public static DimensionId from(DimensionType dimensionType) {
-        return from(DimensionType.getKey(dimensionType));
+        return from(DimensionType.getId(dimensionType));
     }
 
-    public static DimensionId from(ResourceLocation value) {
+    public static DimensionId from(Identifier value) {
         return dimensionIdMap.computeIfAbsent(value, DimensionId::new);
     }
 
     public static DimensionId OVERWORLD = DimensionId.from(DimensionType.OVERWORLD);
     public static DimensionId NETHER = DimensionId.from(DimensionType.THE_NETHER);
 
-    private final ResourceLocation value;
+    private final Identifier value;
 
-    public DimensionId(ResourceLocation value) {
+    public DimensionId(Identifier value) {
         this.value = value;
     }
 
-    public ResourceLocation getValue() {
+    public Identifier getValue() {
         return value;
     }
 
     public DimensionType getDimensionType() {
-        return DimensionType.byName(value);
+        return DimensionType.byId(value);
     }
 
     @Override
index ab3854c686325d38ded40b0d04f4f5fc033c09bf..6da6096f9714c3e91a2eadd1e4e57de48e270248 100644 (file)
@@ -1,18 +1,18 @@
 package com.irtimaled.bbor.common.models;
 
 import com.irtimaled.bbor.common.messages.PayloadBuilder;
-import net.minecraft.entity.player.ServerPlayerEntity;
-import net.minecraft.network.IPacket;
+import net.minecraft.network.Packet;
+import net.minecraft.server.network.ServerPlayerEntity;
 
 import java.util.function.Consumer;
 
 public class ServerPlayer {
     private final DimensionId dimensionId;
-    private final Consumer<IPacket<?>> packetConsumer;
+    private final Consumer<Packet<?>> packetConsumer;
 
     public ServerPlayer(ServerPlayerEntity player) {
         this.dimensionId = DimensionId.from(player.dimension);
-        this.packetConsumer = player.connection::sendPacket;
+        this.packetConsumer = player.networkHandler::sendPacket;
     }
 
     public DimensionId getDimensionId() {
diff --git a/src/main/java/com/irtimaled/bbor/install/Installer.java b/src/main/java/com/irtimaled/bbor/install/Installer.java
deleted file mode 100644 (file)
index dcec4d4..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.irtimaled.bbor.install;
-
-import com.irtimaled.bbor.Versions;
-
-import javax.swing.*;
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-public class Installer {
-    public static void install() {
-        try {
-            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
-        } catch (Throwable t) {
-            t.printStackTrace();
-        }
-
-        try {
-            String osName = getOsName();
-            File minecraftFolder = getMinecraftFolder(osName);
-            String version = "BBOR-" + Versions.minecraft;
-            File versionFolder = new File(minecraftFolder, "versions/" + version + "/");
-            versionFolder.mkdirs();
-
-            File versionJson = new File(versionFolder, version + ".json");
-            Files.copy(Installer.class.getResourceAsStream("/profile.json"), versionJson.toPath(), StandardCopyOption.REPLACE_EXISTING);
-
-            try {
-                File profilesJson = new File(minecraftFolder, "launcher_profiles.json");
-                if (profilesJson.exists()) {
-                    String identifier = "\"" + version.toLowerCase() + "\"";
-                    String contents = new String(Files.readAllBytes(profilesJson.toPath()));
-                    if (contents.contains(identifier)) {
-                        contents = contents.replaceAll(",\n?\\s*" + identifier + "\\s*:\\s*\\{[^}]*},", ",");
-                        contents = contents.replaceAll(",?\n?\\s*" + identifier + "\\s*:\\s*\\{[^}]*},?", "");
-                    }
-
-                    String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
-
-                    contents = contents.replaceAll("([}],\n?\\s*\"profiles\"\\s*:\\s*[{]\n?)", "$1" +
-                            "    " + identifier + ": {\n" +
-                            "      \"name\": \"Bounding Box Outline Reloaded\",\n" +
-                            "      \"type\": \"custom\",\n" +
-                            "      \"created\": \"" + date + "T00:00:00.000Z\",\n" +
-                            "      \"lastUsed\": \"2100-01-01T00:00:00.000Z\",\n" +
-                            "      \"lastVersionId\": \"" + version + "\"\n" +
-                            "    },\n");
-
-                    Files.write(profilesJson.toPath(), contents.getBytes());
-                }
-            } catch (Throwable t) {
-                t.printStackTrace();
-            }
-
-            try {
-                String source = Installer.class.getProtectionDomain().getCodeSource().getLocation().getPath();
-                if (source.startsWith("/") && osName.contains("win")) {
-                    source = source.substring(1);
-                }
-                File mainJar = new File(minecraftFolder, "libraries/com/irtimaled/bbor/" + Versions.minecraft + "/" + version.toLowerCase() + ".jar");
-                mainJar.getParentFile().mkdirs();
-                Files.copy(Paths.get(source), mainJar.toPath(), StandardCopyOption.REPLACE_EXISTING);
-            } catch (Throwable t) {
-                t.printStackTrace();
-            }
-
-            JOptionPane.showMessageDialog(null,
-                    "Bounding Box Outline Reloaded " + Versions.build + " for " + Versions.minecraft + " has been successfully installed!\n" +
-                            "\n" +
-                            "Re-open the Minecraft Launcher to see it in the dropdown.",
-                    "Bounding Box Outline Reloaded Installer", JOptionPane.INFORMATION_MESSAGE);
-        } catch (Throwable t) {
-            StringWriter w = new StringWriter();
-            t.printStackTrace(new PrintWriter(w));
-            JOptionPane.showMessageDialog(null,
-                    "An error occured while installing Bounding Box Outline Reloaded, please report this to the issue\n" +
-                            "tracker (https://github.com/irtimaled/BoundingBoxOutlineReloaded/issues):\n" +
-                            "\n" +
-                            w.toString().replace("\t", "    "), "Bounding Box Outline Reloaded Installer", JOptionPane.ERROR_MESSAGE);
-        }
-    }
-
-    private static File getMinecraftFolder(String osName) {
-        File minecraftFolder;
-        if (osName.contains("win")) {
-            minecraftFolder = new File(System.getenv("APPDATA") + "/.minecraft");
-        } else if (osName.contains("mac")) {
-            minecraftFolder = new File(System.getProperty("user.home") + "/Library/Application Support/minecraft");
-        } else {
-            minecraftFolder = new File(System.getProperty("user.home") + "/.minecraft");
-        }
-        return minecraftFolder;
-    }
-
-    private static String getOsName() {
-        return System.getProperty("os.name").toLowerCase(Locale.ROOT);
-    }
-}
diff --git a/src/main/java/com/irtimaled/bbor/launch/ClientTweaker.java b/src/main/java/com/irtimaled/bbor/launch/ClientTweaker.java
deleted file mode 100644 (file)
index 1d833ea..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.irtimaled.bbor.launch;
-
-import java.io.File;
-import java.util.List;
-
-public class ClientTweaker extends Tweaker {
-    @Override
-    protected void addOptions(List<String> args, File gameDir, File assetsDir, String profile) {
-        if (!isOptifineLoaded()) {
-            super.addOptions(args, gameDir, assetsDir, profile);
-            addArg("--gameDir", gameDir != null ? gameDir.getAbsolutePath() : null);
-            addArg("--assetsDir", assetsDir != null ? assetsDir.getPath() : null);
-            addArg("--version", profile);
-        }
-    }
-
-    private boolean isOptifineLoaded() {
-        try {
-            Class cls = Class.forName("optifine.OptiFineTweaker");
-            return cls != null;
-        } catch (Throwable e) {
-            return false;
-        }
-    }
-
-    @Override
-    public String getLaunchTarget() {
-        return "net.minecraft.client.main.Main";
-    }
-
-    @Override
-    protected boolean isClient() {
-        return true;
-    }
-}
diff --git a/src/main/java/com/irtimaled/bbor/launch/ServerTweaker.java b/src/main/java/com/irtimaled/bbor/launch/ServerTweaker.java
deleted file mode 100644 (file)
index f214d0d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.irtimaled.bbor.launch;
-
-public class ServerTweaker extends Tweaker {
-    @Override
-    protected boolean isClient() {
-        return false;
-    }
-
-    @Override
-    public String getLaunchTarget() {
-        return "net.minecraft.server.MinecraftServer";
-    }
-}
diff --git a/src/main/java/com/irtimaled/bbor/launch/Tweaker.java b/src/main/java/com/irtimaled/bbor/launch/Tweaker.java
deleted file mode 100644 (file)
index b7707d4..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.irtimaled.bbor.launch;
-
-import net.minecraft.launchwrapper.ITweaker;
-import net.minecraft.launchwrapper.LaunchClassLoader;
-import org.spongepowered.asm.launch.MixinBootstrap;
-import org.spongepowered.asm.mixin.MixinEnvironment;
-import org.spongepowered.asm.mixin.Mixins;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class Tweaker implements ITweaker {
-    private List<String> args;
-
-    @Override
-    public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
-        this.args = new ArrayList<>();
-        addOptions(args, gameDir, assetsDir, profile);
-    }
-
-    void addArg(String name, String value) {
-        if (value != null) {
-            args.add(name);
-            args.add(value);
-        }
-    }
-
-    protected void addOptions(List<String> args, File gameDir, File assetsDir, String profile) {
-        this.args.addAll(args);
-    }
-
-    @Override
-    public void injectIntoClassLoader(LaunchClassLoader classLoader) {
-        MixinBootstrap.init();
-        MixinEnvironment.getDefaultEnvironment().setSide(isClient() ? MixinEnvironment.Side.CLIENT : MixinEnvironment.Side.SERVER);
-        Mixins.addConfiguration("mixins.bbor.json");
-    }
-
-    protected abstract boolean isClient();
-
-    @Override
-    public String[] getLaunchArguments() {
-        return args.toArray(new String[0]);
-    }
-}
index 678a16b9f940d6dc2dc0196c9b7141092649bcfd..96b81d2591284b15915a187e43ae0d13ce254ab3 100644 (file)
@@ -2,9 +2,8 @@ package com.irtimaled.bbor.mixin.client;
 
 import com.irtimaled.bbor.client.ClientProxy;
 import com.irtimaled.bbor.client.keyboard.KeyListener;
-import net.minecraft.client.GameSettings;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.client.options.GameOptions;
+import net.minecraft.client.options.KeyBinding;
 import org.apache.commons.lang3.ArrayUtils;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
@@ -14,23 +13,20 @@ import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
-import java.io.File;
-
-@Mixin(GameSettings.class)
+@Mixin(GameOptions.class)
 public abstract class MixinGameSettings {
     @Mutable
     @Final
     @Shadow
-    public KeyBinding[] keyBindings;
+    public KeyBinding[] keysAll;
 
     @Shadow
-    public abstract void loadOptions();
+    public abstract void load();
 
     @Inject(method = "<init>", at = @At("RETURN"))
-    private void init(Minecraft minecraft, File file, CallbackInfo ci) {
+    private void init(CallbackInfo ci) {
         ClientProxy.registerKeyBindings();
-        keyBindings = ArrayUtils.addAll(keyBindings, KeyListener.keyBindings());
-        this.loadOptions();
+        keysAll = ArrayUtils.addAll(keysAll, KeyListener.keyBindings());
+        this.load();
     }
-
 }
index da293f88dda301c63a4e8e3845faec12ed83eb81..ef0643c6fa7e99a0b7e12cd65c8c8dc16ffaa858 100644 (file)
@@ -2,10 +2,10 @@ 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.resources.ClientResourcePackInfo;
-import net.minecraft.resources.ResourcePackList;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.RunArgs;
+import net.minecraft.client.resource.ClientResourcePackProfile;
+import net.minecraft.resource.ResourcePackManager;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
@@ -13,17 +13,17 @@ import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
-@Mixin(Minecraft.class)
+@Mixin(MinecraftClient.class)
 public class MixinMinecraft {
     @Shadow
     @Final
-    private ResourcePackList<ClientResourcePackInfo> resourcePackRepository;
+    private ResourcePackManager<ClientResourcePackProfile> resourcePackManager;
     private ClientProxy clientProxy;
 
     @Inject(method = "<init>", at = @At("RETURN"))
-    private void constructor(GameConfiguration configuration, CallbackInfo ci) {
+    private void constructor(RunArgs configuration, CallbackInfo ci) {
         clientProxy = new ClientProxy();
-        this.resourcePackRepository.addPackFinder(new ModPackFinder());
+        this.resourcePackManager.registerProvider(new ModPackFinder());
     }
 
     @Inject(method = "init", at = @At("RETURN"))
index ad0aa2866c99d32caf112557d82adb9709bf1441..dbf755f062a177edca5c09ebb9194344be7b0bc6 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.mixin.client.entity.player;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.entity.player.ClientPlayerEntity;
+import net.minecraft.client.network.ClientPlayerEntity;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
index a348566e859e2d7bf5b71777f356551c09d877d9..7bb80a0cb99d03f6bd7f8146e4e7719c4c440ee7 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.mixin.client.gui.screen;
 
 import com.irtimaled.bbor.client.gui.ListScreen;
-import net.minecraft.client.Minecraft;
+import net.minecraft.client.MinecraftClient;
 import net.minecraft.client.gui.screen.ChatScreen;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.injection.At;
@@ -10,9 +10,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
 
 @Mixin(ChatScreen.class)
 public class MixinChatScreen {
-    @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)
+    @Inject(method = "keyPressed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;openScreen(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) {
+        if (MinecraftClient.getInstance().currentScreen instanceof ListScreen) {
             cir.setReturnValue(true);
             cir.cancel();
         }
index 39e07f26c5da5ee3501b33b4b94d0feb272f610e..7bd6c52cd0695705f1ad3486ba86c00efd5efa03 100644 (file)
@@ -1,15 +1,15 @@
 package com.irtimaled.bbor.mixin.client.gui.screen;
 
 import com.irtimaled.bbor.client.gui.SettingsScreenButton;
-import net.minecraft.client.gui.screen.OptionsScreen;
 import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.gui.widget.Widget;
+import net.minecraft.client.gui.screen.SettingsScreen;
+import net.minecraft.client.gui.widget.AbstractButtonWidget;
 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(OptionsScreen.class)
+@Mixin(SettingsScreen.class)
 public class MixinOptionsScreen extends Screen {
     private MixinOptionsScreen() {
         super(null);
@@ -20,8 +20,7 @@ public class MixinOptionsScreen extends Screen {
         //shuffle middle buttons up by 12 px to make space
         int top = this.height / 6 + 42;
         int bottom = this.height / 6 + 168;
-
-        for (Widget button : buttons) {
+        for (AbstractButtonWidget button : buttons) {
             if (button.y >= top && button.y < bottom)
                 button.y -= 12;
         }
index 69fc1565bab8a7e21ea55421a10e8508aba56f02..b3b6739ed24f23ae8c1445e5ef04e8ae0eae040d 100644 (file)
@@ -1,13 +1,13 @@
 package com.irtimaled.bbor.mixin.client.network.login;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.network.login.ClientLoginNetHandler;
+import net.minecraft.client.network.ClientLoginNetworkHandler;
 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(ClientLoginNetHandler.class)
+@Mixin(ClientLoginNetworkHandler.class)
 public class MixinClientLoginNetHandler {
     @Inject(method = "onDisconnect", at = @At("HEAD"))
     private void onDisconnect(CallbackInfo ci) {
index 64232ba2cf9cbcab5d36614b2168f46586c5fc5c..6000c6ca9ed4cc3e30e72f0bfe0c169f887df6a2 100644 (file)
@@ -1,13 +1,13 @@
 package com.irtimaled.bbor.mixin.client.network.play;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.network.play.ClientPlayNetHandler;
+import net.minecraft.client.network.ClientPlayNetworkHandler;
 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(ClientPlayNetHandler.class)
+@Mixin(ClientPlayNetworkHandler.class)
 public class MixinClientPlayNetHandler {
     @Inject(method = "onDisconnect", at = @At("HEAD"))
     private void onDisconnect(CallbackInfo ci) {
index 815bfe43d8c489c812f7c590b64acdba04798b90..9ab3ffcb6fd2c2bf9d6f405a351d5385adb4cb26 100644 (file)
@@ -1,8 +1,8 @@
 package com.irtimaled.bbor.mixin.client.renderer;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.renderer.GameRenderer;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.render.GameRenderer;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
@@ -14,10 +14,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 public class MixinGameRenderer {
     @Shadow
     @Final
-    private Minecraft mc;
+    private MinecraftClient client;
 
-    @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))
+    @Inject(method = "renderCenter(FJ)V", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(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);
+        ClientInterop.render(partialTicks, this.client.player);
     }
 }
index f03d0f500525c2309c3885d4d3e3aa0ee2094e9f..c539332b0bbff147eeb571046e181d4c3b0a237b 100644 (file)
@@ -1,7 +1,7 @@
 package com.irtimaled.bbor.mixin.client.settings;
 
 import com.irtimaled.bbor.client.keyboard.KeyListener;
-import net.minecraft.client.settings.KeyBinding;
+import net.minecraft.client.options.KeyBinding;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
@@ -12,9 +12,9 @@ import java.util.Map;
 public class MixinKeyBinding {
     @Final
     @Shadow
-    private static Map<String, Integer> CATEGORY_ORDER;
+    private static Map<String, Integer> categoryOrderMap;
 
     static {
-        CATEGORY_ORDER.put(KeyListener.Category, 0);
+        categoryOrderMap.put(KeyListener.Category, 0);
     }
 }
index caa8be758867ea7850b9b1c2f9d873cc325c67a7..a87dd751f59533db104a107abbd1dcb81b1cf334 100644 (file)
@@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
 @Mixin(ClientWorld.class)
 public class MixinClientWorld {
-    @Inject(method = "sendQuittingDisconnectingPacket", at = @At("RETURN"))
+    @Inject(method = "disconnect", at = @At("RETURN"))
     private void sendQuittingDisconnectingPacket(CallbackInfo ci) {
         ClientInterop.disconnectedFromRemoteServer();
     }
index ab8bf76df347a7063d5cfe778f69fbf69e9fe78e..5f595c3adafe0d48cf4114a19064aec89928f30e 100644 (file)
@@ -2,26 +2,26 @@ 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.play.IServerPlayNetHandler;
-import net.minecraft.network.play.ServerPlayNetHandler;
-import net.minecraft.network.play.client.CCustomPayloadPacket;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.network.listener.ServerPlayPacketListener;
+import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
+import net.minecraft.server.network.ServerPlayNetworkHandler;
+import net.minecraft.util.Identifier;
 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(CCustomPayloadPacket.class)
+@Mixin(CustomPayloadC2SPacket.class)
 public class MixinCCustomPayloadPacket {
     @Shadow
-    private ResourceLocation channel;
+    private Identifier channel;
 
-    @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) {
+    @Redirect(method = "apply", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/listener/ServerPlayPacketListener;onCustomPayload(Lnet/minecraft/network/packet/c2s/play/CustomPayloadC2SPacket;)V"))
+    private void processPacket(ServerPlayPacketListener netHandlerPlayServer, CustomPayloadC2SPacket packet) {
         if (this.channel.toString().equals(SubscribeToServer.NAME)) {
-            CommonInterop.playerSubscribed(((ServerPlayNetHandler) netHandlerPlayServer).player);
+            CommonInterop.playerSubscribed(((ServerPlayNetworkHandler) netHandlerPlayServer).player);
         } else {
-            netHandlerPlayServer.processCustomPayload(packet);
+            netHandlerPlayServer.onCustomPayload(packet);
         }
     }
 }
index 70b279e4dcdd7718e40adce5f2a3a275ec12fdd2..ec61484668f8bdb2154bdf4b6af03bc561792867 100644 (file)
@@ -1,21 +1,21 @@
 package com.irtimaled.bbor.mixin.network.play.server;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.network.play.server.SChatPacket;
-import net.minecraft.util.text.ITextComponent;
+import net.minecraft.network.packet.s2c.play.ChatMessageS2CPacket;
+import net.minecraft.text.Text;
 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.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
-@Mixin(SChatPacket.class)
+@Mixin(ChatMessageS2CPacket.class)
 public class MixinSChatPacket {
     @Shadow
-    private ITextComponent chatComponent;
+    private Text message;
 
-    @Inject(method = "processPacket", at = @At("RETURN"))
+    @Inject(method = "apply", at = @At("RETURN"))
     private void processPacket(CallbackInfo ci) {
-        ClientInterop.handleSeedMessage(this.chatComponent);
+        ClientInterop.handleSeedMessage(this.message);
     }
 }
index ef2525f8c8c7944efeb29c0ee1bb77dc341ed64d..703e23e7c84014f1860ee12c2800d895c2ad00bf 100644 (file)
@@ -1,15 +1,15 @@
 package com.irtimaled.bbor.mixin.network.play.server;
 
 import com.irtimaled.bbor.client.interop.ClientInterop;
-import net.minecraft.client.network.play.IClientPlayNetHandler;
-import net.minecraft.network.play.server.SChunkDataPacket;
+import net.minecraft.network.listener.ClientPlayPacketListener;
+import net.minecraft.network.packet.s2c.play.ChunkDataS2CPacket;
 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.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
-@Mixin(SChunkDataPacket.class)
+@Mixin(ChunkDataS2CPacket.class)
 public class MixinSChunkDataPacket {
     @Shadow
     private int chunkX;
@@ -17,8 +17,8 @@ public class MixinSChunkDataPacket {
     @Shadow
     private int chunkZ;
 
-    @Inject(method = "processPacket", at = @At("RETURN"))
-    private void processPacket(IClientPlayNetHandler netHandlerPlayClient, CallbackInfo ci) {
+    @Inject(method = "apply", at = @At("RETURN"))
+    private void processPacket(ClientPlayPacketListener netHandlerPlayClient, CallbackInfo ci) {
         ClientInterop.receivedChunk(this.chunkX, this.chunkZ);
     }
 }
index 6fbb58bc867956cc0a113b44a5418d4287487dcb..849615031e25fd9de69dd4f71316f741dc5e34c1 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.play.ClientPlayNetHandler;
-import net.minecraft.client.network.play.IClientPlayNetHandler;
-import net.minecraft.network.play.server.SCommandListPacket;
+import net.minecraft.client.network.ClientPlayNetworkHandler;
+import net.minecraft.network.listener.ClientPlayPacketListener;
+import net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket;
 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(SCommandListPacket.class)
+@Mixin(CommandTreeS2CPacket.class)
 public class MixinSCommandListPacket {
-    @Inject(method = "processPacket", at = @At("RETURN"))
-    private void processPacket(IClientPlayNetHandler netHandlerPlayClient, CallbackInfo ci) {
-        TypeHelper.doIfType(netHandlerPlayClient, ClientPlayNetHandler.class, handler ->
+    @Inject(method = "apply", at = @At("RETURN"))
+    private void processPacket(ClientPlayPacketListener netHandlerPlayClient, CallbackInfo ci) {
+        TypeHelper.doIfType(netHandlerPlayClient, ClientPlayNetworkHandler.class, handler ->
                 ClientInterop.registerClientCommands(handler.getCommandDispatcher())
         );
     }
index 137dba1b3a3e3562023f7a1a5a1b0dc68359f517..2ed87c3e6ba62f13ec5866bcca8d896cea2f03ca 100644 (file)
@@ -5,33 +5,33 @@ import com.irtimaled.bbor.common.messages.AddBoundingBox;
 import com.irtimaled.bbor.common.messages.InitializeClient;
 import com.irtimaled.bbor.common.messages.PayloadReader;
 import com.irtimaled.bbor.common.messages.SubscribeToServer;
-import net.minecraft.client.network.play.ClientPlayNetHandler;
-import net.minecraft.client.network.play.IClientPlayNetHandler;
-import net.minecraft.network.PacketBuffer;
-import net.minecraft.network.play.server.SCustomPayloadPlayPacket;
-import net.minecraft.util.ResourceLocation;
+import net.minecraft.client.network.ClientPlayNetworkHandler;
+import net.minecraft.network.listener.ClientPlayPacketListener;
+import net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket;
+import net.minecraft.util.Identifier;
+import net.minecraft.util.PacketByteBuf;
 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(SCustomPayloadPlayPacket.class)
+@Mixin(CustomPayloadS2CPacket.class)
 public abstract class MixinSCustomPayloadPlayPacket {
     @Shadow
-    private ResourceLocation channel;
+    private Identifier channel;
 
-    @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) {
+    @Redirect(method = "apply", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/listener/ClientPlayPacketListener;onCustomPayload(Lnet/minecraft/network/packet/s2c/play/CustomPayloadS2CPacket;)V"))
+    private void processPacket(ClientPlayPacketListener netHandlerPlayClient, CustomPayloadS2CPacket packet) {
         String channelName = channel.toString();
         if (channelName.startsWith("bbor:")) {
-            PacketBuffer data = null;
+            PacketByteBuf data = null;
             try {
-                data = packet.getBufferData();
+                data = packet.getData();
                 PayloadReader reader = new PayloadReader(data);
                 switch (channelName) {
                     case InitializeClient.NAME: {
                         EventBus.publish(InitializeClient.getEvent(reader));
-                        ((ClientPlayNetHandler) netHandlerPlayClient).sendPacket(SubscribeToServer.getPayload().build());
+                        ((ClientPlayNetworkHandler) netHandlerPlayClient).sendPacket(SubscribeToServer.getPayload().build());
                         break;
                     }
                     case AddBoundingBox.NAME:
@@ -45,7 +45,7 @@ public abstract class MixinSCustomPayloadPlayPacket {
                     data.release();
             }
         } else {
-            netHandlerPlayClient.handleCustomPayload(packet);
+            netHandlerPlayClient.onCustomPayload(packet);
         }
     }
 }
index fb8ae64a1e41d2635d4544ef60bde4c817cf9bb6..36afaa96372f4013d53beab3da5422d90ceff9b2 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.SSpawnPositionPacket;
+import net.minecraft.network.packet.s2c.play.PlayerSpawnPositionS2CPacket;
 import net.minecraft.util.math.BlockPos;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
@@ -9,13 +9,13 @@ import org.spongepowered.asm.mixin.injection.At;
 import org.spongepowered.asm.mixin.injection.Inject;
 import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 
-@Mixin(SSpawnPositionPacket.class)
+@Mixin(PlayerSpawnPositionS2CPacket.class)
 public abstract class MixinSSpawnPositionPacket {
     @Shadow
-    private BlockPos spawnBlockPos;
+    private BlockPos pos;
 
-    @Inject(method = "processPacket", at = @At("RETURN"))
+    @Inject(method = "apply", at = @At("RETURN"))
     private void afterProcessPacket(CallbackInfo ci) {
-        ClientInterop.updateWorldSpawnReceived(spawnBlockPos);
+        ClientInterop.updateWorldSpawnReceived(pos);
     }
 }
index b669222c06eab5bdfe3b0550d758ef768d2d7764..257aed8e1ea638dfbb4ee0e356e781dc663c6784 100644 (file)
@@ -2,8 +2,8 @@ package com.irtimaled.bbor.mixin.server;
 
 import com.irtimaled.bbor.common.interop.CommonInterop;
 import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.world.ServerWorld;
 import net.minecraft.world.dimension.DimensionType;
-import net.minecraft.world.server.ServerWorld;
 import org.spongepowered.asm.mixin.Final;
 import org.spongepowered.asm.mixin.Mixin;
 import org.spongepowered.asm.mixin.Shadow;
@@ -19,7 +19,7 @@ public class MixinMinecraftServer {
     @Final
     private Map<DimensionType, ServerWorld> worlds;
 
-    @Inject(method = "loadInitialChunks", at = @At("HEAD"))
+    @Inject(method = "prepareStartRegion", at = @At("HEAD"))
     private void initialWorldChunkLoad(CallbackInfo ci) {
         CommonInterop.loadWorlds(worlds.values());
     }
index 193bb81a28198ac32cce3772007436262f26bfc9..4a4ad206f55cad4a78c38898b4da98b0e3fc1df1 100644 (file)
@@ -1,15 +1,15 @@
 package com.irtimaled.bbor.mixin.server.dedicated;
 
 import com.irtimaled.bbor.common.CommonProxy;
-import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.server.dedicated.MinecraftDedicatedServer;
 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(DedicatedServer.class)
+@Mixin(MinecraftDedicatedServer.class)
 public class MixinDedicatedServer {
-    @Inject(method = "init", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/dedicated/DedicatedServer;loadAllWorlds(Ljava/lang/String;Ljava/lang/String;JLnet/minecraft/world/WorldType;Lcom/google/gson/JsonElement;)V"))
+    @Inject(method = "setupServer", at = @At(value = "NEW", target = "net/minecraft/server/dedicated/DedicatedPlayerManager"))
     private void init(CallbackInfoReturnable<Boolean> cir) {
         new CommonProxy().init();
     }
index e296394a28abc1ac19cdd71fec1fa9a030e9aa30..ef43ff89db19fd5dd7e06b4c0d819a4ead34f9ac 100644 (file)
@@ -1,22 +1,22 @@
 package com.irtimaled.bbor.mixin.server.management;
 
 import com.irtimaled.bbor.common.interop.CommonInterop;
-import net.minecraft.entity.player.ServerPlayerEntity;
-import net.minecraft.network.NetworkManager;
-import net.minecraft.server.management.PlayerList;
+import net.minecraft.network.ClientConnection;
+import net.minecraft.server.PlayerManager;
+import net.minecraft.server.network.ServerPlayerEntity;
 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(PlayerList.class)
+@Mixin(PlayerManager.class)
 public class MixinPlayerList {
-    @Inject(method = "initializeConnectionToPlayer", at = @At("RETURN"))
-    private void playerLoggedIn(NetworkManager networkManager, ServerPlayerEntity player, CallbackInfo ci) {
+    @Inject(method = "onPlayerConnect", at = @At("RETURN"))
+    private void playerLoggedIn(ClientConnection netManager, ServerPlayerEntity player, CallbackInfo ci) {
         CommonInterop.playerLoggedIn(player);
     }
 
-    @Inject(method = "playerLoggedOut", at = @At("HEAD"))
+    @Inject(method = "remove", at = @At("HEAD"))
     private void playerLoggedOut(ServerPlayerEntity player, CallbackInfo ci) {
         CommonInterop.playerLoggedOut(player);
     }
index dc5f146dcf475c982aa665b3d7184c1554f8b4c1..5906a339ebe80500b8b4a88e3508c3afd8ed1c3b 100644 (file)
@@ -1,16 +1,16 @@
 package com.irtimaled.bbor.mixin.world.chunk;
 
 import com.irtimaled.bbor.common.interop.CommonInterop;
-import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.WorldChunk;
 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(Chunk.class)
+@Mixin(WorldChunk.class)
 public class MixinChunk {
-    @Inject(method = "func_217318_w", at = @At("RETURN"))
+    @Inject(method = "loadToWorld", at = @At("RETURN"))
     private void onLoad(CallbackInfo ci) {
-        CommonInterop.chunkLoaded((Chunk) (Object) this);
+        CommonInterop.chunkLoaded((WorldChunk) (Object) this);
     }
 }
diff --git a/src/main/java/com/irtimaled/bbor/server/ServerRunner.java b/src/main/java/com/irtimaled/bbor/server/ServerRunner.java
deleted file mode 100644 (file)
index 79aa871..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.irtimaled.bbor.server;
-
-import com.irtimaled.bbor.Versions;
-import net.minecraft.launchwrapper.Launch;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.nio.channels.Channels;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ServerRunner {
-    private static final Map<String, String> VANILLA_SERVER_JARS = new HashMap<>();
-
-    private static final String[] LIBRARIES = {
-            "https://github.com/irtimaled/Mixin/releases/download/org/spongepowered/mixin/0.7.11-SNAPSHOT/mixin-0.7.11-SNAPSHOT.jar",
-            "https://repo1.maven.org/maven2/org/ow2/asm/asm/6.2/asm-6.2.jar",
-            "https://repo1.maven.org/maven2/org/ow2/asm/asm-commons/6.2/asm-commons-6.2.jar",
-            "https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/6.2/asm-tree-6.2.jar",
-            "https://libraries.minecraft.net/net/minecraft/launchwrapper/1.12/launchwrapper-1.12.jar"
-    };
-
-    private static final ThrowableConsumer<URL> addURL;
-
-    static {
-        VANILLA_SERVER_JARS.put("1.14.4", "https://launcher.mojang.com/v1/objects/3dc3d84a581f14691199cf6831b71ed1296a9fdf/server.jar");
-        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 {
-            Method method = URLClassLoader.class
-                    .getDeclaredMethod("addURL", URL.class);
-            method.setAccessible(true);
-            addURL = url -> method.invoke(ClassLoader.getSystemClassLoader(), url);
-        } catch (ReflectiveOperationException e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    private static void addURLToClasspath(File file) throws MalformedURLException {
-        addURL.accept(file.toURI().toURL());
-    }
-
-    public static void run(List<String> args) throws IOException {
-        String serverJarUrl = VANILLA_SERVER_JARS.get(Versions.minecraft);
-
-        addURLToClasspath(getOrDownload(new File("."), serverJarUrl));
-        for (String url : LIBRARIES) {
-            addURLToClasspath(getOrDownload(new File("libs"), url));
-        }
-
-        args = new ArrayList<>(args);
-        args.add("--tweakClass");
-        args.add("com.irtimaled.bbor.launch.ServerTweaker");
-
-        System.out.println("Launching server...");
-        Launch.main(args.toArray(new String[0]));
-    }
-
-    private static File getOrDownload(File directory, String url) throws IOException {
-        String fileName = url.substring(url.lastIndexOf('/') + 1);
-        File target = new File(directory, fileName);
-        if (target.isFile()) {
-            return target;
-        }
-        target.getParentFile().mkdirs();
-
-        System.out.println("Downloading library: " + url);
-        new FileOutputStream(target).getChannel()
-                .transferFrom(Channels.newChannel(new URL(url).openStream()), 0, Long.MAX_VALUE);
-
-        return target;
-    }
-}
diff --git a/src/main/java/com/irtimaled/bbor/server/ThrowableConsumer.java b/src/main/java/com/irtimaled/bbor/server/ThrowableConsumer.java
deleted file mode 100644 (file)
index 77c0324..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.irtimaled.bbor.server;
-
-import com.irtimaled.bbor.common.TypeHelper;
-
-import java.util.function.Consumer;
-
-public interface ThrowableConsumer<T> extends Consumer<T> {
-    @Override
-    default void accept(final T elem) {
-        try {
-            acceptThrows(elem);
-        } catch (final Throwable t) {
-            throw TypeHelper.as(t, RuntimeException.class, () -> new RuntimeException(t));
-        }
-    }
-
-    void acceptThrows(T elem) throws Throwable;
-}
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
new file mode 100644 (file)
index 0000000..b9d605b
--- /dev/null
@@ -0,0 +1,13 @@
+{
+  "schemaVersion": 1,
+  "id": "bbor",
+  "name": "BoundingBoxOutlineReloaded",
+  "description": "Shows the bounding boxes of structures and features.",
+  "authors": [
+    "Irtimaled"
+  ],
+  "version": "$version",
+  "mixins": [
+    "mixins.bbor.json"
+  ]
+}
diff --git a/src/main/resources/profile.json b/src/main/resources/profile.json
deleted file mode 100644 (file)
index 536f1e9..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-{
-  "inheritsFrom": "${mcVersion}",
-  "id": "BBOR-${mcVersion}",
-  "jar": "${mcVersion}",
-  "time": "${formattedTime}",
-  "type": "release",
-  "arguments": {
-    "game": [
-      "--tweakClass",
-      "${tweakClass}"
-    ]
-  },
-  "mainClass": "net.minecraft.launchwrapper.Launch",
-  "libraries": [
-    {
-      "name": "com.irtimaled:bbor:${mcVersion}",
-      "url": "https://github.com/irtimaled/maven/releases/download/"
-    },
-    {
-      "name": "org.spongepowered:mixin:0.8",
-      "url": "https://github.com/irtimaled/maven/releases/download/"
-    },
-    {
-      "name": "org.ow2.asm:asm:6.2",
-      "url": "https://repo1.maven.org/maven2/"
-    },
-    {
-      "name": "org.ow2.asm:asm-tree:6.2",
-      "url": "https://repo1.maven.org/maven2/"
-    },
-    {
-      "name": "org.ow2.asm:asm-commons:6.2",
-      "url": "https://repo1.maven.org/maven2/"
-    },
-    {
-      "name": "org.ow2.asm:asm-util:6.2",
-      "url": "https://repo1.maven.org/maven2/"
-    },
-    {
-      "name": "org.ow2.asm:asm-analysis:6.2",
-      "url": "https://repo1.maven.org/maven2/"
-    },
-    {
-      "name": "net.minecraft:launchwrapper:1.12"
-    }
-  ]
-}
\ No newline at end of file