From a1ac87f80dec9f5febf14b312373fd35a8e061e9 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 23 Aug 2023 19:47:07 -0600 Subject: [PATCH 01/13] bump unimined --- build.gradle | 31 +++++++++---------- buildSrc/build.gradle | 8 +++-- .../baritone/gradle/task/ProguardTask.java | 25 +++++++-------- fabric/build.gradle | 18 +++++------ forge/build.gradle | 21 +++++++------ gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- tweaker/build.gradle | 10 +++--- 8 files changed, 60 insertions(+), 57 deletions(-) diff --git a/build.gradle b/build.gradle index b981972d3..1f5cd9419 100755 --- a/build.gradle +++ b/build.gradle @@ -21,13 +21,12 @@ allprojects { apply plugin: "maven-publish" archivesBaseName = rootProject.archives_base_name - def vers = 'git describe --always --tags --dirty'.execute().text.trim() - if (!vers.startsWith("v")) { - println "git doesn't appear to be installed!" + def vers = 'git describe --always --dirty'.execute().text.trim() + if (vers.isEmpty()) { println "using version number: " + rootProject.mod_version version = rootProject.mod_version } else { - version = vers.substring(1) + version = rootProject.mod_version + "-" + vers } group = rootProject.maven_group @@ -66,12 +65,6 @@ allprojects { } dependencies { - minecraft "net.minecraft:minecraft:${rootProject.minecraft_version}" - // The following line declares the mojmap mappings, you may use other mappings as well - mappings "net.fabricmc:intermediary:${rootProject.minecraft_version}:v2" - mappings "net.minecraft:minecraft:${rootProject.minecraft_version}:client-mappings" - mappings "org.parchmentmc.data:parchment-1.19.2:2022.11.27@zip" - implementation "org.spongepowered:mixin:0.8.5" implementation "org.ow2.asm:asm:9.3" // The following line declares the yarn mappings you may select this one as well. @@ -80,6 +73,16 @@ allprojects { implementation 'dev.babbaj:nether-pathfinder:1.3.0' } + unimined.minecraft(sourceSets.main, true) { + version rootProject.minecraft_version + + mappings { + intermediary() + mojmap() + parchment("2023.06.26") + } + } + tasks.withType(JavaCompile).configureEach { it.options.encoding = "UTF-8" @@ -90,8 +93,9 @@ allprojects { } } -minecraft { +unimined.minecraft { runs.off = true + defaultRemapJar = false } archivesBaseName = archivesBaseName + "-common" @@ -131,11 +135,6 @@ jar { from sourceSets.main.output, sourceSets.launch.output, sourceSets.api.output } -remapJar { - targetNamespace = "named" - fallbackTargetNamespace = "intermediary" -} - javadoc { options.addStringOption('Xwerror', '-quiet') // makes the build fail on travis when there is a javadoc error options.linkSource true diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 14b7dc3bb..d894aeec2 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -29,12 +29,16 @@ repositories { name = 'FabricMaven' url = 'https://maven.fabricmc.net/' } + maven { + name = 'NeoForgedMaven' + url = 'https://maven.neoforged.net/' + } mavenCentral() } dependencies { implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0' - implementation group: 'commons-io', name: 'commons-io', version: '2.6' + implementation group: 'commons-io', name: 'commons-io', version: '2.7' - implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '0.3.4' + implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '1.0.5' } \ No newline at end of file diff --git a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java index bad182c1f..c2f3c5be7 100644 --- a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java +++ b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java @@ -20,14 +20,14 @@ import baritone.gradle.util.Determinizer; import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.tasks.Input; +import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.TaskCollection; import org.gradle.api.tasks.compile.ForkOptions; import org.gradle.api.tasks.compile.JavaCompile; import org.gradle.internal.jvm.Jvm; -import xyz.wagyourtail.unimined.api.Constants; -import xyz.wagyourtail.unimined.api.minecraft.EnvType; -import xyz.wagyourtail.unimined.api.minecraft.MinecraftProvider; +import xyz.wagyourtail.unimined.api.UniminedExtension; +import xyz.wagyourtail.unimined.api.minecraft.MinecraftConfig; import java.io.*; import java.net.URL; @@ -35,7 +35,6 @@ import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.stream.Stream; import java.util.zip.ZipEntry; @@ -63,8 +62,6 @@ public String getExtract() { private List requiredLibraries; - private File pathfinder; - @TaskAction protected void exec() throws Exception { super.doFirst(); @@ -74,21 +71,23 @@ protected void exec() throws Exception { downloadProguard(); extractProguard(); generateConfigs(); - pathfinder = acquireDependencies().filter(file -> file.getName().contains("nether-pathfinder")).findAny().get(); processArtifact(); proguardApi(); proguardStandalone(); cleanup(); } - MinecraftProvider provider = this.getProject().getExtensions().getByType(MinecraftProvider.class); + UniminedExtension ext = getProject().getExtensions().getByType(UniminedExtension.class); + SourceSetContainer sourceSets = getProject().getExtensions().getByType(SourceSetContainer.class); private File getMcJar() { - return provider.getMinecraftWithMapping(EnvType.COMBINED, provider.getMcPatcher().getProdNamespace(), provider.getMcPatcher().getProdFallbackNamespace()).toFile(); + MinecraftConfig mcc = ext.getMinecrafts().get(sourceSets.getByName("main")); + return mcc.getMinecraft(mcc.getMcPatcher().getProdNamespace(), mcc.getMcPatcher().getProdNamespace()).toFile(); } private boolean isMcJar(File f) { - return this.getProject().getConfigurations().getByName(Constants.MINECRAFT_COMBINED_PROVIDER).getFiles().contains(f); + MinecraftConfig mcc = ext.getMinecrafts().get(sourceSets.getByName("main")); + return mcc.isMinecraftJar(f.toPath()); } private void processArtifact() throws Exception { @@ -96,7 +95,7 @@ private void processArtifact() throws Exception { Files.delete(this.artifactUnoptimizedPath); } - Determinizer.determinize(this.artifactPath.toString(), this.artifactUnoptimizedPath.toString(), Arrays.asList(pathfinder), false); + Determinizer.determinize(this.artifactPath.toString(), this.artifactUnoptimizedPath.toString(), List.of(), false); } private void downloadProguard() throws Exception { @@ -253,12 +252,12 @@ private Stream acquireDependencies() { private void proguardApi() throws Exception { runProguard(getTemporaryFile(compType + PROGUARD_API_CONFIG)); - Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString(), Arrays.asList(pathfinder), false); + Determinizer.determinize(this.proguardOut.toString(), this.artifactApiPath.toString(), List.of(), false); } private void proguardStandalone() throws Exception { runProguard(getTemporaryFile(compType + PROGUARD_STANDALONE_CONFIG)); - Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString(), Arrays.asList(pathfinder), false); + Determinizer.determinize(this.proguardOut.toString(), this.artifactStandalonePath.toString(), List.of(), false); } private static final class Pair { diff --git a/fabric/build.gradle b/fabric/build.gradle index c88ff80ef..f3798343e 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -19,15 +19,14 @@ import baritone.gradle.task.CreateDistTask import baritone.gradle.task.ProguardTask plugins { - id "com.github.johnrengelman.shadow" version "7.0.0" + id "com.github.johnrengelman.shadow" version "8.0.0" } archivesBaseName = archivesBaseName + "-fabric" -minecraft { - fabric() - runs.client = { - jvmArgs.add("-XstartOnFirstThread") +unimined.minecraft { + fabric { + loader project.fabric_version } } @@ -39,8 +38,6 @@ configurations { } dependencies { - fabric "net.fabricmc:fabric-loader:${project.fabric_version}" - // because of multiple sourcesets `common project(":")` doesn't work for (sourceSet in rootProject.sourceSets) { if (sourceSet == rootProject.sourceSets.test) continue @@ -48,6 +45,7 @@ dependencies { common sourceSet.output shadowCommon sourceSet.output } + include 'dev.babbaj:nether-pathfinder:1.3.0' } processResources { @@ -60,17 +58,17 @@ processResources { shadowJar { configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier.set "dev-shadow" } remapJar { inputFile.set shadowJar.archiveFile dependsOn shadowJar - classifier null + archiveClassifier.set null } jar { - classifier "dev" + archiveClassifier.set "dev" } components.java { diff --git a/forge/build.gradle b/forge/build.gradle index bac8ca54a..d12da3201 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -19,15 +19,19 @@ import baritone.gradle.task.CreateDistTask import baritone.gradle.task.ProguardTask plugins { - id "com.github.johnrengelman.shadow" version "7.0.0" + id "com.github.johnrengelman.shadow" version "8.0.0" } archivesBaseName = archivesBaseName + "-forge" -minecraft { +unimined.minecraft { + mappings { + devFallbackNamespace "intermediary" + } + forge { - devFallbackNamespace = "intermediary" - mixinConfig = ["mixins.baritone.json"] + loader project.forge_version + mixinConfig ["mixins.baritone.json"] } } @@ -45,8 +49,6 @@ configurations { } dependencies { - forge "net.minecraftforge:forge:${rootProject.forge_version}" - // because of multiple sourcesets `common project(":")` doesn't work for (sourceSet in rootProject.sourceSets) { if (sourceSet == rootProject.sourceSets.test) continue @@ -54,6 +56,7 @@ dependencies { common sourceSet.output shadowCommon sourceSet.output } + shadowCommon 'dev.babbaj:nether-pathfinder:1.3.0' } processResources { @@ -66,17 +69,17 @@ processResources { shadowJar { configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier.set "dev-shadow" } remapJar { inputFile.set shadowJar.archiveFile dependsOn shadowJar - classifier null + archiveClassifier.set null } jar { - classifier "dev" + archiveClassifier.set "dev" manifest { attributes( diff --git a/gradle.properties b/gradle.properties index 1de9c913d..77fe67e7f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,5 +5,5 @@ maven_group=baritone archives_base_name=baritone minecraft_version=1.19.4 -forge_version=1.19.4-45.0.43 +forge_version=45.0.43 fabric_version=0.14.11 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 00e33edef..15de90249 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/tweaker/build.gradle b/tweaker/build.gradle index ce623af6c..724c50d29 100644 --- a/tweaker/build.gradle +++ b/tweaker/build.gradle @@ -20,10 +20,10 @@ import baritone.gradle.task.ProguardTask //import baritone.gradle.task.TweakerJsonAssembler plugins { - id "com.github.johnrengelman.shadow" version "7.0.0" + id "com.github.johnrengelman.shadow" version "8.0.0" } -minecraft { +unimined.minecraft { runs.client = { mainClass = "net.minecraft.launchwrapper.Launch" args.addAll(["--tweakClass", "baritone.launch.BaritoneTweaker"]) @@ -67,18 +67,18 @@ dependencies { shadowJar { configurations = [project.configurations.shadowCommon] - classifier "dev-shadow" + archiveClassifier.set "dev-shadow" } remapJar { inputFile.set shadowJar.archiveFile dependsOn shadowJar - classifier null + archiveClassifier.set null } jar { - classifier "dev" + archiveClassifier.set "dev" preserveFileTimestamps = false reproducibleFileOrder = true From 9ad273a46c689cb469b3da1fd870615b7c805ebe Mon Sep 17 00:00:00 2001 From: Babbaj Date: Sat, 23 Sep 2023 17:00:11 -0400 Subject: [PATCH 02/13] silence elytra chat spam --- fabric/build.gradle | 2 +- src/api/java/baritone/api/Settings.java | 5 +++ .../java/baritone/process/ElytraProcess.java | 20 ++++++------ .../process/elytra/ElytraBehavior.java | 32 +++++++++++-------- 4 files changed, 35 insertions(+), 24 deletions(-) diff --git a/fabric/build.gradle b/fabric/build.gradle index c88ff80ef..30ed3926d 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -103,4 +103,4 @@ publishing { repositories { // Add repositories to publish to here. } -} \ No newline at end of file +} diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index adbbd6eaa..9171a3d68 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -1468,6 +1468,11 @@ public final class Settings { */ public final Setting elytraTermsAccepted = new Setting<>(false); + /** + * Verbose chat logging in elytra mode + */ + public final Setting elytraChatSpam = new Setting<>(false); + /** * A map of lowercase setting field names to their respective setting */ diff --git a/src/main/java/baritone/process/ElytraProcess.java b/src/main/java/baritone/process/ElytraProcess.java index d1e10a5cf..2c57c6f55 100644 --- a/src/main/java/baritone/process/ElytraProcess.java +++ b/src/main/java/baritone/process/ElytraProcess.java @@ -69,6 +69,16 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro private ElytraBehavior behavior; private boolean predictingTerrain; + @Override + public void onLostControl() { + this.state = State.START_FLYING; // TODO: null state? + this.goingToLandingSpot = false; + this.landingSpot = null; + this.reachedGoal = false; + this.goal = null; + destroyBehaviorAsync(); + } + private ElytraProcess(Baritone baritone) { super(baritone); baritone.getGameEventHandler().registerEventListener(this); @@ -276,16 +286,6 @@ public void landingSpotIsBad(BetterBlockPos endPos) { this.state = State.FLYING; } - @Override - public void onLostControl() { - this.goal = null; - this.goingToLandingSpot = false; - this.landingSpot = null; - this.reachedGoal = false; - this.state = State.START_FLYING; // TODO: null state? - destroyBehaviorAsync(); - } - private void destroyBehaviorAsync() { ElytraBehavior behavior = this.behavior; if (behavior != null) { diff --git a/src/main/java/baritone/process/elytra/ElytraBehavior.java b/src/main/java/baritone/process/elytra/ElytraBehavior.java index 501c6a22b..d4913f466 100644 --- a/src/main/java/baritone/process/elytra/ElytraBehavior.java +++ b/src/main/java/baritone/process/elytra/ElytraBehavior.java @@ -174,9 +174,9 @@ public CompletableFuture pathToDestination(final BlockPos from) { .thenRun(() -> { final double distance = this.path.get(0).distanceTo(this.path.get(this.path.size() - 1)); if (this.completePath) { - logDirect(String.format("Computed path (%.1f blocks in %.4f seconds)", distance, (System.nanoTime() - start) / 1e9d)); + logVerbose(String.format("Computed path (%.1f blocks in %.4f seconds)", distance, (System.nanoTime() - start) / 1e9d)); } else { - logDirect(String.format("Computed segment (Next %.1f blocks in %.4f seconds)", distance, (System.nanoTime() - start) / 1e9d)); + logVerbose(String.format("Computed segment (Next %.1f blocks in %.4f seconds)", distance, (System.nanoTime() - start) / 1e9d)); } }) .whenComplete((result, ex) -> { @@ -231,9 +231,9 @@ public void pathNextSegment(final int afterIncl) { final double distance = this.path.get(0).distanceTo(this.path.get(recompute)); if (this.completePath) { - logDirect(String.format("Computed path (%.1f blocks in %.4f seconds)", distance, (System.nanoTime() - start) / 1e9d)); + logVerbose(String.format("Computed path (%.1f blocks in %.4f seconds)", distance, (System.nanoTime() - start) / 1e9d)); } else { - logDirect(String.format("Computed segment (Next %.1f blocks in %.4f seconds)", distance, (System.nanoTime() - start) / 1e9d)); + logVerbose(String.format("Computed segment (Next %.1f blocks in %.4f seconds)", distance, (System.nanoTime() - start) / 1e9d)); } }) .whenComplete((result, ex) -> { @@ -243,7 +243,7 @@ public void pathNextSegment(final int afterIncl) { if (cause instanceof PathCalculationException) { logDirect("Failed to compute next segment"); if (ctx.player().distanceToSqr(pathStart.getCenter()) < 16 * 16) { - logDirect("Player is near the segment start, therefore repeating this calculation is pointless. Marking as complete"); + logVerbose("Player is near the segment start, therefore repeating this calculation is pointless. Marking as complete"); completePath = true; } } else { @@ -321,7 +321,7 @@ private void pathfindAroundObstacles() { if (ElytraBehavior.this.process.state != ElytraProcess.State.LANDING && this.ticksNearUnchanged > 100) { this.pathRecalcSegment(OptionalInt.of(rangeEndExcl - 1)) .thenRun(() -> { - logDirect("Recalculating segment, no progress in last 100 ticks"); + logVerbose("Recalculating segment, no progress in last 100 ticks"); }); this.ticksNearUnchanged = 0; return; @@ -348,7 +348,7 @@ private void pathfindAroundObstacles() { final long start = System.nanoTime(); this.pathRecalcSegment(rejoinMainPathAt) .thenRun(() -> { - logDirect(String.format("Recalculated segment around path blockage near %s %s %s (next %.1f blocks in %.4f seconds)", + logVerbose(String.format("Recalculated segment around path blockage near %s %s %s (next %.1f blocks in %.4f seconds)", SettingsUtil.maybeCensor(blockage.x), SettingsUtil.maybeCensor(blockage.y), SettingsUtil.maybeCensor(blockage.z), @@ -360,7 +360,7 @@ private void pathfindAroundObstacles() { } } if (!canSeeAny && rangeStartIncl < rangeEndExcl - 2 && process.state != ElytraProcess.State.GET_TO_JUMP) { - this.pathRecalcSegment(OptionalInt.of(rangeEndExcl - 1)).thenRun(() -> logDirect("Recalculated segment since no path points were visible")); + this.pathRecalcSegment(OptionalInt.of(rangeEndExcl - 1)).thenRun(() -> logVerbose("Recalculated segment since no path points were visible")); } } @@ -581,10 +581,10 @@ public void tick() { trySwapElytra(); if (ctx.player().horizontalCollision) { - logDirect("hbonk"); + logVerbose("hbonk"); } if (ctx.player().verticalCollision) { - logDirect("vbonk"); + logVerbose("vbonk"); } final SolverContext solverContext = this.new SolverContext(false); @@ -609,14 +609,14 @@ public void tick() { } if (solution == null) { - logDirect("no solution"); + logVerbose("no solution"); return; } baritone.getLookBehavior().updateTarget(solution.rotation, false); if (!solution.solvedPitch) { - logDirect("no pitch solution, probably gonna crash in a few ticks LOL!!!"); + logVerbose("no pitch solution, probably gonna crash in a few ticks LOL!!!"); return; } else { this.aimPos = new BetterBlockPos(solution.goingTo.x, solution.goingTo.y, solution.goingTo.z); @@ -758,7 +758,7 @@ private void tickUseFireworks(final Vec3 start, final Vec3 goingTo, final boolea logDirect("no fireworks"); return; } - logDirect("attempting to use firework" + (forceUseFirework ? " (forced)" : "")); + logVerbose("attempting to use firework" + (forceUseFirework ? " (forced)" : "")); ctx.playerController().processRightClick(ctx.player(), ctx.world(), InteractionHand.MAIN_HAND); this.minimumBoostTicks = 10 * (1 + getFireworkBoost(ctx.player().getItemInHand(InteractionHand.MAIN_HAND)).orElse(0)); this.remainingFireworkTicks = 10; @@ -1317,4 +1317,10 @@ private void trySwapElytra() { queueWindowClick(ctx.player().inventoryMenu.containerId, slotId, 0, ClickType.PICKUP); } } + + void logVerbose(String message) { + if (Baritone.settings().elytraChatSpam.value) { + logDebug(message); + } + } } From 3332ec9e1ff60f985cde0d1bd120025b795d6e24 Mon Sep 17 00:00:00 2001 From: Xiaodown Date: Wed, 11 Oct 2023 19:25:51 -0700 Subject: [PATCH 03/13] Adds git to the Dockerfile apt install I saw in setup.md "(if you have docker on Windows, I'd be grateful if you could let me know if it works there too)". So I went to build it on Windows. I use Windows Subsystem for Linux, which is (mostly) Ubuntu but not really (there's no init). But Docker Desktop has an integration for WSL2. For me, gradle wouldn't build the image without forcing git to install in the container. I'll attach screenshots to the pull request. It just looks like whatever ubuntu:focal my docker system grabbed doesn't have git installed by default. Anyway, this fixes it, and shouldn't screw anything even if git is installed by default. I tested it on my M1 Mac pro and it still works fine. --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 9023e2020..8a00fc3da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ RUN apt update -y RUN apt install \ openjdk-17-jdk \ + git \ --assume-yes COPY . /code From 1dd2a334d6747ff8575ae54deabb217496c312af Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:33:15 +0200 Subject: [PATCH 04/13] Handle duplicate palette entries --- .../baritone/cache/FasterWorldScanner.java | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/main/java/baritone/cache/FasterWorldScanner.java b/src/main/java/baritone/cache/FasterWorldScanner.java index 65e56975a..b6d3d8963 100644 --- a/src/main/java/baritone/cache/FasterWorldScanner.java +++ b/src/main/java/baritone/cache/FasterWorldScanner.java @@ -20,6 +20,7 @@ import baritone.api.cache.ICachedWorld; import baritone.api.cache.IWorldScanner; import baritone.api.utils.BetterBlockPos; +import baritone.api.utils.BlockOptionalMeta; import baritone.api.utils.BlockOptionalMetaLookup; import baritone.api.utils.IPlayerContext; import baritone.utils.accessor.IPalettedContainer; @@ -45,6 +46,9 @@ public enum FasterWorldScanner implements IWorldScanner { INSTANCE; + + private static final BlockState[] PALETTE_REGISTRY_SENTINEL = new BlockState[0]; + @Override public List scanChunkRadius(IPlayerContext ctx, BlockOptionalMetaLookup filter, int max, int yLevelThreshold, int maxSearchRadius) { assert ctx.world() != null; @@ -219,13 +223,18 @@ private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection sect private boolean[] getIncludedFilterIndices(BlockOptionalMetaLookup lookup, Palette palette) { boolean commonBlockFound = false; - IdMapper paletteMap = getPalette(palette); - int size = paletteMap.size(); + BlockState[] paletteMap = getPalette(palette); + + if (paletteMap == PALETTE_REGISTRY_SENTINEL) { + return getIncludedFilterIndicesFromRegistry(lookup); + } + + int size = paletteMap.length; boolean[] isInFilter = new boolean[size]; for (int i = 0; i < size; i++) { - BlockState state = paletteMap.byId(i); + BlockState state = paletteMap[i]; if (lookup.has(state)) { isInFilter[i] = true; commonBlockFound = true; @@ -240,21 +249,34 @@ private boolean[] getIncludedFilterIndices(BlockOptionalMetaLookup lookup, Palet return isInFilter; } + private boolean[] getIncludedFilterIndicesFromRegistry(BlockOptionalMetaLookup lookup) { + boolean[] isInFilter = new boolean[Block.BLOCK_STATE_REGISTRY.size()]; + + for (BlockOptionalMeta bom : lookup.blocks()) { + for (BlockState state : bom.getAllBlockStates()) { + isInFilter[Block.BLOCK_STATE_REGISTRY.getId(state)] = true; + } + } + + return isInFilter; + } + /** * cheats to get the actual map of id -> blockstate from the various palette implementations */ - private static IdMapper getPalette(Palette palette) { + private static BlockState[] getPalette(Palette palette) { if (palette instanceof GlobalPalette) { - return Block.BLOCK_STATE_REGISTRY; + // copying the entire registry is not nice so we treat it as a special case + return PALETTE_REGISTRY_SENTINEL; } else { FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer()); palette.write(buf); int size = buf.readVarInt(); - IdMapper states = new IdMapper<>(); + BlockState[] states = new BlockState[size]; for (int i = 0; i < size; i++) { BlockState state = Block.BLOCK_STATE_REGISTRY.byId(buf.readVarInt()); assert state != null; - states.addMapping(state, i); + states[i] = state; } return states; } From 0ca81b14bf438351725072cfd3deb3ac41f8df9c Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:34:25 +0200 Subject: [PATCH 05/13] Restore `buildIgnoreExisting` --- src/main/java/baritone/process/BuilderProcess.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 86378bbbc..0ae796e6e 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -1063,6 +1063,9 @@ private boolean valid(BlockState current, BlockState desired, boolean itemVerify if (desired.getBlock() instanceof AirBlock && Baritone.settings().buildIgnoreBlocks.value.contains(current.getBlock())) { return true; } + if (!(current.getBlock() instanceof AirBlock) && Baritone.settings().buildIgnoreExisting.value && !itemVerify) { + return true; + } if (Baritone.settings().buildSkipBlocks.value.contains(desired.getBlock()) && !itemVerify) { return true; } From 20d62c68bfacbac3173dfa8f819b4d05e40d4a68 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Sun, 15 Oct 2023 20:50:23 +0200 Subject: [PATCH 06/13] Slightly better version strings --- .github/workflows/gradle_build.yml | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 08e9ab1d3..9d4ed379b 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -28,7 +28,7 @@ jobs: run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew build -Pmod_version="$(git describe --always --tags | cut -c2-)" + run: ./gradlew build -Pmod_version="$(git describe --always --tags --first-parent | cut -c2-)" - name: Archive Artifacts uses: actions/upload-artifact@v3 diff --git a/build.gradle b/build.gradle index 9371211b0..b8cc58196 100755 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ allprojects { apply plugin: "maven-publish" archivesBaseName = rootProject.archives_base_name - def vers = 'git describe --always --tags --dirty'.execute().text.trim() + def vers = 'git describe --always --tags --first-parent --dirty'.execute().text.trim() if (!vers.startsWith("v")) { println "git doesn't appear to be installed!" println "using version number: " + rootProject.mod_version From 9accb2bfb0bea36cfe63940f2cc20f39af73517c Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Sun, 15 Oct 2023 20:51:17 +0200 Subject: [PATCH 07/13] Don't crash the build if git is not available --- build.gradle | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index b8cc58196..dbbc2cebb 100755 --- a/build.gradle +++ b/build.gradle @@ -21,13 +21,18 @@ allprojects { apply plugin: "maven-publish" archivesBaseName = rootProject.archives_base_name - def vers = 'git describe --always --tags --first-parent --dirty'.execute().text.trim() + def vers = "" + try { + vers = 'git describe --always --tags --first-parent --dirty'.execute().text.trim() + } catch (Exception e) { + println "Version detection failed: " + e + } if (!vers.startsWith("v")) { - println "git doesn't appear to be installed!" println "using version number: " + rootProject.mod_version version = rootProject.mod_version } else { version = vers.substring(1) + println "Detected version " + version } group = rootProject.maven_group From 19accb0d9025db392af2fe4a3f79ffdc41df4960 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Thu, 16 Nov 2023 23:21:01 +0100 Subject: [PATCH 08/13] Fix scanning in chunks using a SingleValuePalette --- .../baritone/cache/FasterWorldScanner.java | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/cache/FasterWorldScanner.java b/src/main/java/baritone/cache/FasterWorldScanner.java index b6d3d8963..cabc76d64 100644 --- a/src/main/java/baritone/cache/FasterWorldScanner.java +++ b/src/main/java/baritone/cache/FasterWorldScanner.java @@ -38,6 +38,7 @@ import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.chunk.Palette; import net.minecraft.world.level.chunk.PalettedContainer; +import net.minecraft.world.level.chunk.SingleValuePalette; import java.util.ArrayList; import java.util.List; @@ -191,7 +192,29 @@ private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection sect return; } - boolean[] isInFilter = getIncludedFilterIndices(lookup, ((IPalettedContainer) sectionContainer).getPalette()); + int yOffset = section.bottomBlockY(); + Palette palette = ((IPalettedContainer) sectionContainer).getPalette(); + + if (palette instanceof SingleValuePalette) { + // single value palette doesn't have any data + if (lookup.has(palette.valueFor(0))) { + // TODO this is 4k hits, maybe don't return all of them? + for (int x = 0; x < 16; ++x) { + for (int y = 0; y < 16; ++y) { + for (int z = 0; z < 16; ++z) { + blocks.add(new BlockPos( + (int) chunkX + x, + yOffset + y, + (int) chunkZ + z + )); + } + } + } + } + return; + } + + boolean[] isInFilter = getIncludedFilterIndices(lookup, palette); if (isInFilter.length == 0) { return; } @@ -202,9 +225,6 @@ private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection sect int bitsPerEntry = array.getBits(); long maxEntryValue = (1L << bitsPerEntry) - 1L; - - int yOffset = section.bottomBlockY(); - for (int i = 0, idx = 0; i < longArray.length && idx < arraySize; ++i) { long l = longArray[i]; for (int offset = 0; offset <= (64 - bitsPerEntry) && idx < arraySize; offset += bitsPerEntry, ++idx) { From c1b555c2890cfdfba8c038bdeccfbf742299edfc Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Thu, 23 Nov 2023 19:11:39 -0700 Subject: [PATCH 09/13] bump parchment --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 086d16c90..7d043618c 100755 --- a/build.gradle +++ b/build.gradle @@ -86,7 +86,7 @@ allprojects { mappings { intermediary() mojmap() - parchment("2023.06.26") + parchment("2023.10.22") } } From 3dbcf0102a09f3da1854487b32f1bd50ceca205a Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Thu, 23 Nov 2023 19:14:10 -0700 Subject: [PATCH 10/13] fix forge version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9cf5e6f4c..7654ecc47 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,5 +7,5 @@ maven_group=baritone archives_base_name=baritone minecraft_version=1.20.2 -forge_version=1.20.2-48.0.1 +forge_version=48.0.1 fabric_version=0.14.22 From 21feeb664ed74e31471cef81d483d490a15361b9 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Thu, 23 Nov 2023 19:31:55 -0700 Subject: [PATCH 11/13] fix missing function --- src/main/java/baritone/cache/FasterWorldScanner.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/baritone/cache/FasterWorldScanner.java b/src/main/java/baritone/cache/FasterWorldScanner.java index 4912764c4..e364fd7b4 100644 --- a/src/main/java/baritone/cache/FasterWorldScanner.java +++ b/src/main/java/baritone/cache/FasterWorldScanner.java @@ -192,7 +192,6 @@ private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection sect return; } - int yOffset = section.bottomBlockY(); Palette palette = ((IPalettedContainer) sectionContainer).getPalette(); if (palette instanceof SingleValuePalette) { @@ -204,7 +203,7 @@ private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection sect for (int z = 0; z < 16; ++z) { blocks.add(new BlockPos( (int) chunkX + x, - yOffset + y, + sectionY + y, (int) chunkZ + z )); } From 4b6652b4cf7632567d90a4ec2aa163e0f4f4497d Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Thu, 7 Dec 2023 14:18:39 -0700 Subject: [PATCH 12/13] 1.20.4 --- build.gradle | 6 +- buildSrc/build.gradle | 2 +- fabric/build.gradle | 2 +- fabric/src/main/resources/fabric.mod.json | 3 +- forge/build.gradle | 2 +- forge/src/main/resources/META-INF/mods.toml | 2 +- gradle.properties | 11 +- neoforge/build.gradle | 134 ++++++++++++++++++ neoforge/gradle.properties | 18 +++ .../baritone/launch/BaritoneForgeModXD.java | 24 ++++ .../src/main/resources/META-INF/mods.toml | 40 ++++++ neoforge/src/main/resources/pack.mcmeta | 6 + .../launch/mixins/MixinMinecraft.java | 5 +- .../baritone/command/defaults/SelCommand.java | 2 +- .../java/baritone/process/BuilderProcess.java | 3 +- .../java/baritone/selection/Selection.java | 2 +- .../baritone/selection/SelectionRenderer.java | 4 +- .../format/DefaultSchematicFormats.java | 7 +- 18 files changed, 251 insertions(+), 22 deletions(-) create mode 100644 neoforge/build.gradle create mode 100644 neoforge/gradle.properties create mode 100644 neoforge/src/main/java/baritone/launch/BaritoneForgeModXD.java create mode 100644 neoforge/src/main/resources/META-INF/mods.toml create mode 100644 neoforge/src/main/resources/pack.mcmeta diff --git a/build.gradle b/build.gradle index 7d043618c..011f08993 100755 --- a/build.gradle +++ b/build.gradle @@ -77,7 +77,9 @@ allprojects { // The following line declares the yarn mappings you may select this one as well. // mappings "net.fabricmc:yarn:1.17.1+build.32:v2" //launchImplementation('dev.babbaj:nether-pathfinder:1.3.0') - implementation 'dev.babbaj:nether-pathfinder:1.4.1' + implementation "dev.babbaj:nether-pathfinder:${nether_pathfinder_version}" + + implementation 'com.google.code.findbugs:jsr305:3.0.2' } unimined.minecraft(sourceSets.main, true) { @@ -86,7 +88,7 @@ allprojects { mappings { intermediary() mojmap() - parchment("2023.10.22") + parchment("1.20.2", "2023.10.22") } } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index d894aeec2..a58fe6089 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -40,5 +40,5 @@ dependencies { implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0' implementation group: 'commons-io', name: 'commons-io', version: '2.7' - implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '1.0.5' + implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '1.1.0' } \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 9674f4e7a..e6a88b352 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -45,7 +45,7 @@ dependencies { common sourceSet.output shadowCommon sourceSet.output } - include 'dev.babbaj:nether-pathfinder:1.3.0' + include "dev.babbaj:nether-pathfinder:${nether_pathfinder_version}" } processResources { diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 6fd5c42df..0260fcb1a 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -1,4 +1,3 @@ - { "schemaVersion": 1, "id": "baritone", @@ -26,6 +25,6 @@ "depends": { "fabricloader": ">=0.14.22", - "minecraft": "1.20.2" + "minecraft": "1.20.4" } } diff --git a/forge/build.gradle b/forge/build.gradle index d12da3201..6ec55bc12 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -56,7 +56,7 @@ dependencies { common sourceSet.output shadowCommon sourceSet.output } - shadowCommon 'dev.babbaj:nether-pathfinder:1.3.0' + shadowCommon "dev.babbaj:nether-pathfinder:${nether_pathfinder_version}" } processResources { diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 24b35ab23..1dc9b341c 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -35,6 +35,6 @@ A Minecraft pathfinder bot. modId="minecraft" mandatory=true # This version range declares a minimum of the current minecraft version up to but not including the next major version -versionRange="[1.20.2]" +versionRange="[1.20.4]" ordering="NONE" side="BOTH" diff --git a/gradle.properties b/gradle.properties index 7654ecc47..35c62e0a7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,16 @@ org.gradle.jvmargs=-Xmx4G -available_loaders=fabric,forge,tweaker +available_loaders=fabric,forge,neoforge,tweaker mod_version=1.10.2 maven_group=baritone archives_base_name=baritone -minecraft_version=1.20.2 -forge_version=48.0.1 +minecraft_version=1.20.4 + +forge_version=49.0.3 +neoforge_version=0-beta + fabric_version=0.14.22 + +nether_pathfinder_version=1.4.1 \ No newline at end of file diff --git a/neoforge/build.gradle b/neoforge/build.gradle new file mode 100644 index 000000000..ac102dace --- /dev/null +++ b/neoforge/build.gradle @@ -0,0 +1,134 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +import baritone.gradle.task.CreateDistTask +import baritone.gradle.task.ProguardTask + +plugins { + id "com.github.johnrengelman.shadow" version "8.0.0" +} + +archivesBaseName = archivesBaseName + "-neoforge" + +unimined.minecraft { + mappings { + devFallbackNamespace "intermediary" + } + + neoForged { + loader project.neoforge_version + mixinConfig ["mixins.baritone.json"] + } + + minecraftRemapper.config { + // neoforge adds 1 conflict, where 2 interfaces have a method with the same name on yarn/mojmap, + // but the method has different names in the intermediary mappings. + // this is a conflict because they have a class that extends both interfaces. + // this shouldn't be a problem as long as named mappings don't make the name of those 2 methods different. + ignoreConflicts(true) + } + +} + +//loom { +// forge { +// mixinConfig 'mixins.baritone.json' +// } +//} + +configurations { + common + shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this. + compileClasspath.extendsFrom common + runtimeClasspath.extendsFrom common +} + +dependencies { + // because of multiple sourcesets `common project(":")` doesn't work + for (sourceSet in rootProject.sourceSets) { + if (sourceSet == rootProject.sourceSets.test) continue + if (sourceSet == rootProject.sourceSets.schematica_api) continue + common sourceSet.output + shadowCommon sourceSet.output + } + shadowCommon "dev.babbaj:nether-pathfinder:${nether_pathfinder_version}" +} + +processResources { + inputs.property "version", project.version + + filesMatching("META-INF/mods.toml") { + expand "version": project.version + } +} + +shadowJar { + configurations = [project.configurations.shadowCommon] + archiveClassifier.set "dev-shadow" +} + +remapJar { + inputFile.set shadowJar.archiveFile + dependsOn shadowJar + archiveClassifier.set null +} + +jar { + archiveClassifier.set "dev" + + manifest { + attributes( + 'MixinConfigs': 'mixins.baritone.json', + "MixinConnector": "baritone.launch.BaritoneMixinConnector", + + 'Implementation-Title': 'Baritone', + 'Implementation-Version': version, + ) + } +} + +components.java { + withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) { + skip() + } +} + +task proguard(type: ProguardTask) { + url 'https://github.com/Guardsquare/proguard/releases/download/v7.2.1/proguard-7.2.1.zip' + extract 'proguard-7.2.1/lib/proguard.jar' + compType "neoforge" +} + +task createDist(type: CreateDistTask, dependsOn: proguard) { + compType "neoforge" +} + +build.finalizedBy(createDist) + +publishing { + publications { + mavenFabric(MavenPublication) { + artifactId = rootProject.archives_base_name + "-" + project.name + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + } +} \ No newline at end of file diff --git a/neoforge/gradle.properties b/neoforge/gradle.properties new file mode 100644 index 000000000..24befc474 --- /dev/null +++ b/neoforge/gradle.properties @@ -0,0 +1,18 @@ +# +# This file is part of Baritone. +# +# Baritone is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Baritone is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Baritone. If not, see . +# + +loom.platform=forge \ No newline at end of file diff --git a/neoforge/src/main/java/baritone/launch/BaritoneForgeModXD.java b/neoforge/src/main/java/baritone/launch/BaritoneForgeModXD.java new file mode 100644 index 000000000..de097320d --- /dev/null +++ b/neoforge/src/main/java/baritone/launch/BaritoneForgeModXD.java @@ -0,0 +1,24 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package baritone.launch; + +import net.neoforged.fml.common.Mod; + +@Mod("baritoe") +public class BaritoneForgeModXD { +} diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/mods.toml new file mode 100644 index 000000000..6b2bdd876 --- /dev/null +++ b/neoforge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,40 @@ +# This is an example mods.toml file. It contains the data relating to the loading mods. +# There are several mandatory fields (#mandatory), and many more that are optional (#optional). +# The overall format is standard TOML format, v0.5.0. +# Note that there are a couple of TOML lists in this file. +# Find more information on toml format here: https://github.com/toml-lang/toml +# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml +modLoader="javafml" #mandatory +# A version range to match for said mod loader - for regular FML @Mod it will be the forge version +loaderVersion="[1,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +license="https://raw.githubusercontent.com/cabaletta/baritone/1.16.2/LICENSE" +# A URL to refer people to when problems occur with this mod +issueTrackerURL="https://github.com/cabaletta/baritone/issues" #optional +# A list of mods - how many allowed here is determined by the individual mod loader +[[mods]] #mandatory +# The modid of the mod +modId="baritoe" #mandatory +# The version number of the mod - there's a few well known ${} variables useable here or just hardcode it +version="${version}" #mandatory + # A display name for the mod +displayName="Baritone" #mandatory +# A URL for the "homepage" for this mod, displayed in the mod UI +displayURL="https://github.com/cabaletta/baritone" #optional +# A file name (in the root of the mod JAR) containing a logo for display +#logoFile="examplemod.png" #optional +# A text field displayed in the mod UI +credits="Hat Gamers" #optional +# A text field displayed in the mod UI +authors="leijurv, Brady" #optional +# The description text for the mod (multi line!) (#mandatory) +description=''' +A Minecraft pathfinder bot. +''' + +[[dependencies.baritoe]] +modId="minecraft" +mandatory=true +# This version range declares a minimum of the current minecraft version up to but not including the next major version +versionRange="[1.20.4]" +ordering="NONE" +side="BOTH" diff --git a/neoforge/src/main/resources/pack.mcmeta b/neoforge/src/main/resources/pack.mcmeta new file mode 100644 index 000000000..663d1787a --- /dev/null +++ b/neoforge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "null", + "pack_format": 8 + } +} \ No newline at end of file diff --git a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java index 17aece562..e615a822a 100644 --- a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java +++ b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java @@ -171,9 +171,8 @@ private void postLoadWorld(ClientLevel world, CallbackInfo ci) { ), slice = @Slice( from = @At( - value = "FIELD", - opcode = Opcodes.GETFIELD, - target = "Lnet/minecraft/client/Options;renderDebug:Z" + value = "INVOKE", + target = "Lnet/minecraft/client/gui/components/DebugScreenOverlay;showDebugScreen()Z" ), to = @At( value = "CONSTANT", diff --git a/src/main/java/baritone/command/defaults/SelCommand.java b/src/main/java/baritone/command/defaults/SelCommand.java index 14d22b0b4..a374e92e8 100644 --- a/src/main/java/baritone/command/defaults/SelCommand.java +++ b/src/main/java/baritone/command/defaults/SelCommand.java @@ -76,7 +76,7 @@ public void onRenderPass(RenderEvent event) { float lineWidth = Baritone.settings().selectionLineWidth.value; boolean ignoreDepth = Baritone.settings().renderSelectionIgnoreDepth.value; IRenderer.startLines(color, opacity, lineWidth, ignoreDepth); - IRenderer.emitAABB(event.getModelViewStack(), new AABB(pos1, pos1.offset(1, 1, 1))); + IRenderer.emitAABB(event.getModelViewStack(), new AABB(pos1)); IRenderer.endLines(ignoreDepth); } }); diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 94b9af207..6913d5be0 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -50,6 +50,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; +import net.minecraft.nbt.NbtAccounter; import net.minecraft.nbt.NbtIo; import net.minecraft.util.Tuple; import net.minecraft.world.InteractionHand; @@ -222,7 +223,7 @@ public void buildOpenLitematic(int i) { if (LitematicaHelper.hasLoadedSchematic()) { String name = LitematicaHelper.getName(i); try { - LitematicaSchematic schematic1 = new LitematicaSchematic(NbtIo.readCompressed(Files.newInputStream(LitematicaHelper.getSchematicFile(i).toPath())), false); + LitematicaSchematic schematic1 = new LitematicaSchematic(NbtIo.readCompressed(Files.newInputStream(LitematicaHelper.getSchematicFile(i).toPath()), NbtAccounter.unlimitedHeap()), false); Vec3i correctedOrigin = LitematicaHelper.getCorrectedOrigin(schematic1, i); ISchematic schematic2 = LitematicaHelper.blackMagicFuckery(schematic1, i); schematic2 = applyMapArtAndSelection(origin, (IStaticSchematic) schematic2); diff --git a/src/main/java/baritone/selection/Selection.java b/src/main/java/baritone/selection/Selection.java index d4b115de4..69c77d668 100644 --- a/src/main/java/baritone/selection/Selection.java +++ b/src/main/java/baritone/selection/Selection.java @@ -37,7 +37,7 @@ public Selection(BetterBlockPos pos1, BetterBlockPos pos2) { max.z - min.z + 1 ); - this.aabb = new AABB(this.min, this.max.offset(1, 1, 1)); + this.aabb = new AABB(this.min); } @Override diff --git a/src/main/java/baritone/selection/SelectionRenderer.java b/src/main/java/baritone/selection/SelectionRenderer.java index 94cbb2d90..4250f4085 100644 --- a/src/main/java/baritone/selection/SelectionRenderer.java +++ b/src/main/java/baritone/selection/SelectionRenderer.java @@ -38,13 +38,13 @@ public static void renderSelections(PoseStack stack, ISelection[] selections) { IRenderer.glColor(settings.colorSelectionPos1.value, opacity); for (ISelection selection : selections) { - IRenderer.emitAABB(stack, new AABB(selection.pos1(), selection.pos1().offset(1, 1, 1))); + IRenderer.emitAABB(stack, new AABB(selection.pos1())); } IRenderer.glColor(settings.colorSelectionPos2.value, opacity); for (ISelection selection : selections) { - IRenderer.emitAABB(stack, new AABB(selection.pos2(), selection.pos2().offset(1, 1, 1))); + IRenderer.emitAABB(stack, new AABB(selection.pos2())); } } diff --git a/src/main/java/baritone/utils/schematic/format/DefaultSchematicFormats.java b/src/main/java/baritone/utils/schematic/format/DefaultSchematicFormats.java index 17fafc821..94a01a157 100644 --- a/src/main/java/baritone/utils/schematic/format/DefaultSchematicFormats.java +++ b/src/main/java/baritone/utils/schematic/format/DefaultSchematicFormats.java @@ -22,6 +22,7 @@ import baritone.utils.schematic.format.defaults.LitematicaSchematic; import baritone.utils.schematic.format.defaults.MCEditSchematic; import baritone.utils.schematic.format.defaults.SpongeSchematic; +import net.minecraft.nbt.NbtAccounter; import org.apache.commons.io.FilenameUtils; import java.io.File; @@ -44,7 +45,7 @@ public enum DefaultSchematicFormats implements ISchematicFormat { MCEDIT("schematic") { @Override public IStaticSchematic parse(InputStream input) throws IOException { - return new MCEditSchematic(NbtIo.readCompressed(input)); + return new MCEditSchematic(NbtIo.readCompressed(input, NbtAccounter.unlimitedHeap())); } }, @@ -56,7 +57,7 @@ public IStaticSchematic parse(InputStream input) throws IOException { SPONGE("schem") { @Override public IStaticSchematic parse(InputStream input) throws IOException { - CompoundTag nbt = NbtIo.readCompressed(input); + CompoundTag nbt = NbtIo.readCompressed(input, NbtAccounter.unlimitedHeap()); int version = nbt.getInt("Version"); switch (version) { case 1: @@ -74,7 +75,7 @@ public IStaticSchematic parse(InputStream input) throws IOException { LITEMATICA("litematic") { @Override public IStaticSchematic parse(InputStream input) throws IOException { - CompoundTag nbt = NbtIo.readCompressed(input); + CompoundTag nbt = NbtIo.readCompressed(input, NbtAccounter.unlimitedHeap()); int version = nbt.getInt("Version"); switch (version) { case 4: //1.12 From c146440cb2950e339169ad64c4ec54bdf1ae609f Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Sun, 17 Dec 2023 03:36:23 -0700 Subject: [PATCH 13/13] mark 1.20.3 as supported --- fabric/src/main/resources/fabric.mod.json | 2 +- forge/src/main/resources/META-INF/mods.toml | 2 +- neoforge/src/main/resources/META-INF/mods.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 0260fcb1a..c1512a6cc 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -25,6 +25,6 @@ "depends": { "fabricloader": ">=0.14.22", - "minecraft": "1.20.4" + "minecraft": ["1.20.3", "1.20.4"] } } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 1dc9b341c..dd309314c 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -35,6 +35,6 @@ A Minecraft pathfinder bot. modId="minecraft" mandatory=true # This version range declares a minimum of the current minecraft version up to but not including the next major version -versionRange="[1.20.4]" +versionRange="[1.20.3, 1.20.4]" ordering="NONE" side="BOTH" diff --git a/neoforge/src/main/resources/META-INF/mods.toml b/neoforge/src/main/resources/META-INF/mods.toml index 6b2bdd876..4ad41a286 100644 --- a/neoforge/src/main/resources/META-INF/mods.toml +++ b/neoforge/src/main/resources/META-INF/mods.toml @@ -35,6 +35,6 @@ A Minecraft pathfinder bot. modId="minecraft" mandatory=true # This version range declares a minimum of the current minecraft version up to but not including the next major version -versionRange="[1.20.4]" +versionRange="[1.20.3, 1.20.4]" ordering="NONE" side="BOTH"