From 4b6652b4cf7632567d90a4ec2aa163e0f4f4497d Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Thu, 7 Dec 2023 14:18:39 -0700 Subject: [PATCH] 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