vanilla-fixes

Minecraft: Better than Adventure! mod that fixes some issues
git clone git://memoryshards.xyz/vanilla-fixes.git
Log | Files | Refs | README | LICENSE

commit a93e1426bedfad634fb41259a2f4b3f07dadc782
parent 896c3c1bd78de7f46d0a6b2c57af2eb3860c7a2f
Author: Amb0s <ambos@disroot.org>
Date:   Thu,  3 Aug 2023 03:07:03 +0200

Updated mod to BTA! 1.7.7.0

Diffstat:
MREADME.md | 6+++---
Mbuild.gradle | 46+++++++++++++++++++++++++---------------------
Mgradle.properties | 12++++--------
Mgradle/wrapper/gradle-wrapper.properties | 2+-
Msettings.gradle | 4++++
Msrc/main/java/ambos/vanillafixes/VanillaFixes.java | 4----
Asrc/main/java/ambos/vanillafixes/mixin/DisplayListMixin.java | 42++++++++++++++++++++++++++++++++++++++++++
Dsrc/main/java/ambos/vanillafixes/mixin/GuiGameOverMixin.java | 21---------------------
Msrc/main/java/ambos/vanillafixes/mixin/GuiMainMenuMixin.java | 33+++++++++++++++++++++++++++------
Dsrc/main/java/ambos/vanillafixes/mixin/RenderListMixin.java | 41-----------------------------------------
Dsrc/main/resources/fabric.mod.json | 35-----------------------------------
Asrc/main/resources/quilt.mod.json | 18++++++++++++++++++
Msrc/main/resources/vanillafixes.mixins.json | 25++++++++++++-------------
13 files changed, 136 insertions(+), 153 deletions(-)

diff --git a/README.md b/README.md @@ -1,12 +1,12 @@ # Vanilla Fixes ## Fixes - * Jittering -* Score display + +## Improvements * Minimal main menu ## Instructions -Check the [BTA! modding wiki](https://github.com/Amb0s/bta-modding-documentation/wiki) +Soon... diff --git a/build.gradle b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'babric-loom' version '0.12-SNAPSHOT' + id "org.quiltmc.loom" version "1.+" id 'java' } @@ -8,9 +8,10 @@ archivesBaseName = project.mod_name version = project.mod_version loom { - gluedMinecraftJar() + clientOnlyMinecraftJar() + //serverOnlyMinecraftJar() noIntermediateMappings() - customMinecraftManifest.set("https://github.com/Turnip-Labs/bta-manifest-repo/releases/download/v1.7.6.2_02/1.7.6.2_02.json") + customMinecraftManifest.set("https://github.com/MartinSVK12/bta-manifest-repo/releases/download/v${project.bta_version}/${project.bta_version}.json") } repositories { @@ -26,7 +27,15 @@ repositories { ivy { url = "https://github.com/Better-than-Adventure" patternLayout { - artifact("[organisation]/releases/download/v[revision]/[module].jar") + artifact "[organisation]/releases/download/v[revision]/[module].jar" + m2compatible = true + } + metadataSources { artifact() } + } + ivy { + url = "https://github.com/Turnip-Labs" + patternLayout { + artifact "[organisation]/releases/download/v[revision]/[module]-[revision].jar" m2compatible = true } metadataSources { artifact() } @@ -39,22 +48,25 @@ repositories { } metadataSources { artifact() } } + ivy { + url = "https://github.com/MartinSVK12" + patternLayout { + artifact "[organisation]/releases/download/[revision]/[module]-[revision].jar" + m2compatible = true + } + metadataSources { artifact() } + } } dependencies { minecraft "bta-download-repo:bta:${project.bta_version}" - mappings loom.layered() {} + mappings loom.layered {} - // Only used to fix the Client run configuration - modRuntimeOnly "objects:client:43db9b498cb67058d2e12d394e6507722e71bb45" - - modImplementation "babric:fabric-loader:${project.loader_version}" + modRuntimeOnly "objects:client:43db9b498cb67058d2e12d394e6507722e71bb45" // https://piston-data.mojang.com/v1/objects/43db9b498cb67058d2e12d394e6507722e71bb45/client.jar + modImplementation("quilt-loader:quilt-loader:${project.loader_version}") modImplementation "org.slf4j:slf4j-api:1.8.0-beta4" modImplementation "org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0" - - modImplementation "org.apache.commons:commons-lang3:3.12.0" - include "org.apache.commons:commons-lang3:3.12.0" } java { @@ -63,7 +75,7 @@ java { withSourcesJar() } -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { options.release.set 8 } @@ -72,11 +84,3 @@ jar { rename { "${it}_${archivesBaseName}" } } } - -processResources { - inputs.property "version", version - - filesMatching("fabric.mod.json") { - expand "version": version - } -} diff --git a/gradle.properties b/gradle.properties @@ -1,16 +1,12 @@ org.gradle.jvmargs=-Xmx2G # BTA -bta_version=1.7.6.2_02 +bta_version=1.7.7.0 -# Loader Dependencies -asm_version=9.3 -mixin_version=0.11.4+mixin.0.8.5 - -# Loader -loader_version=0.14.6-babric.1 +# Loader (quilt) +loader_version=0.20.0-beta.3-bta # Mod -mod_version=2.0.1 +mod_version=3.0.0 mod_group=ambos mod_name=vanilla-fixes diff --git 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.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle @@ -13,5 +13,9 @@ pluginManagement { name = 'Babric' url = 'https://maven.glass-launcher.net/babric' } + maven { + name = 'Quilt' + url = 'https://maven.quiltmc.org/repository/release' + } } } \ No newline at end of file diff --git a/src/main/java/ambos/vanillafixes/VanillaFixes.java b/src/main/java/ambos/vanillafixes/VanillaFixes.java @@ -8,10 +8,6 @@ public class VanillaFixes implements ModInitializer { public static final String MOD_ID = "vanillafixes"; public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); - public static String name(String name) { - return VanillaFixes.MOD_ID + "." + name; - } - @Override public void onInitialize() { LOGGER.info("VanillaFixes initialized"); diff --git a/src/main/java/ambos/vanillafixes/mixin/DisplayListMixin.java b/src/main/java/ambos/vanillafixes/mixin/DisplayListMixin.java @@ -0,0 +1,42 @@ +package ambos.vanillafixes.mixin; + +import net.minecraft.client.render.DisplayList; +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.ModifyArgs; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; + +@Mixin(value = DisplayList.class, remap = false) +final class DisplayListMixin { + private double offsetX; + private double offsetY; + private double offsetZ; + + @Shadow + private int posX; + + @Shadow + private int posY; + + @Shadow + private int posZ; + + @Inject(method = "setToPos", at = @At("RETURN"), require = 0) + private void onSetToPos(int blockX, int blockY, int blockZ, double offsetX, double offsetY, double offsetZ, + CallbackInfo ci) { + this.offsetX = offsetX; + this.offsetY = offsetY; + this.offsetZ = offsetZ; + } + + @ModifyArgs(method = "call", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glTranslatef(FFF)V"), + require = 0) + private void changeType(Args args) { + args.set(0, (float) ((double) this.posX - this.offsetX)); + args.set(1, (float) ((double) this.posY - this.offsetY)); + args.set(2, (float) ((double) this.posZ - this.offsetZ)); + } +} diff --git a/src/main/java/ambos/vanillafixes/mixin/GuiGameOverMixin.java b/src/main/java/ambos/vanillafixes/mixin/GuiGameOverMixin.java @@ -1,21 +0,0 @@ -package ambos.vanillafixes.mixin; - -import net.minecraft.src.GuiGameOver; -import net.minecraft.src.GuiScreen; -import net.minecraft.src.command.ChatColor; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyArgs; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; - -@Mixin(value = GuiGameOver.class, remap = false) -final class GuiGameOverMixin extends GuiScreen { - @ModifyArgs(method = "drawScreen", at = @At(value = "INVOKE", - target = "Lnet/minecraft/src/GuiGameOver;drawCenteredString(Lnet/minecraft/src/FontRenderer;Ljava/lang/String;III)V"), - require = 0) - private void changeGameOverMessage(Args args) { - if (args.get(1) != "Game over!") { - args.set(1, "Score: " + ChatColor.yellow + this.mc.thePlayer.getScore()); - } - } -} diff --git a/src/main/java/ambos/vanillafixes/mixin/GuiMainMenuMixin.java b/src/main/java/ambos/vanillafixes/mixin/GuiMainMenuMixin.java @@ -1,16 +1,36 @@ package ambos.vanillafixes.mixin; -import net.minecraft.src.GuiMainMenu; -import net.minecraft.src.GuiScreen; +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.GuiScreen; 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.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; @Mixin(value = GuiMainMenu.class, remap = false) final class GuiMainMenuMixin extends GuiScreen { + @Inject(method = "initGui", at = @At("RETURN"), require = 0) private void removeLinks(CallbackInfo ci) { - controlList.removeIf(button -> button.id == 5 || button.id == 6 || button.id == 7); // Remove the links + controlList.removeIf(button -> button.id == 5 || button.id == 6 || button.id == 7); + } + + @Inject(method = "initGui", at = @At("RETURN"), require = 0) + private void removeButtons(CallbackInfo ci) { + controlList.removeIf(button -> button.id == 3 || button.id == 8); + } + + @ModifyArgs(method = "drawScreen", at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/render/FontRenderer;drawCenteredString(Ljava/lang/String;III)V"), + require = 0) + private void removeDownloadingResourcesString(Args args) { + args.set(0, ""); + } + + /* + @ModifyConstant(method = "drawScreen", constant = @Constant(stringValue = "")) + private String removeConstantString(String value) { + return ""; } -} + */ +} +\ No newline at end of file diff --git a/src/main/java/ambos/vanillafixes/mixin/RenderListMixin.java b/src/main/java/ambos/vanillafixes/mixin/RenderListMixin.java @@ -1,41 +0,0 @@ -package ambos.vanillafixes.mixin; - -import net.minecraft.src.RenderList; -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.ModifyArgs; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.invoke.arg.Args; - -@Mixin(value = RenderList.class, remap = false) -public class RenderListMixin { - private double field_1239_d_store; - private double field_1238_e_store; - private double field_1237_f_store; - - @Shadow - private int field_1242_a; - - @Shadow - private int field_1241_b; - - @Shadow - private int field_1240_c; - - @Inject(method = "func_861_a", at = @At("RETURN"), cancellable = true, require = 0) - private void onFunc_861_a(int i, int j, int k, double d, double d1, double d2, CallbackInfo ci) { - this.field_1239_d_store = d; - this.field_1238_e_store = d1; - this.field_1237_f_store = d2; - } - - @ModifyArgs(method = "func_860_a", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glTranslatef(FFF)V"), - require = 0) - private void changeType(Args args) { - args.set(0, (float) ((double) this.field_1242_a - this.field_1239_d_store)); - args.set(1, (float) ((double) this.field_1241_b - this.field_1238_e_store)); - args.set(2, (float) ((double) this.field_1240_c - this.field_1237_f_store)); - } -} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json @@ -1,35 +0,0 @@ -{ - "schemaVersion": 1, - "id": "vanillafixes", - "version": "${version}", - - "name": "Vanilla Fixes", - "description": "Fixes some issues present in the base game.", - "authors": [ - "Ambos" - ], - "contact": { - "homepage": "https://github.com/Amb0s/vanilla-fixes", - "sources": "https://github.com/Amb0s/vanilla-fixes", - "issues": "https://github.com/Amb0s/vanilla-fixes/issues" - }, - - "license": "MIT", - "icon": "icon.png", - - "environment": "*", - "entrypoints": { - "main": [ - "ambos.vanillafixes.VanillaFixes" - ] - }, - "mixins": [ - "vanillafixes.mixins.json" - ], - - "depends": { - "fabricloader": ">=0.13.3" - }, - "suggests": { - } -} diff --git a/src/main/resources/quilt.mod.json b/src/main/resources/quilt.mod.json @@ -0,0 +1,17 @@ +{ + "schema_version": 1, + "quilt_loader": { + "entrypoints": { + "main": [ + "ambos.vanillafixes.VanillaFixes" + ] + }, + "group": "ambos", + "id":"vanillafixes", + "version": "3.0.0", + "intermediate_mappings": "net.fabricmc:intermediary" + }, + "mixin": [ + "vanillafixes.mixins.json" + ] +} +\ No newline at end of file diff --git a/src/main/resources/vanillafixes.mixins.json b/src/main/resources/vanillafixes.mixins.json @@ -1,16 +1,15 @@ { - "required": true, - "minVersion": "0.8", - "package": "ambos.vanillafixes.mixin", - "compatibilityLevel": "JAVA_8", - "mixins": [ - ], - "client": [ - "GuiGameOverMixin", - "GuiMainMenuMixin", - "RenderListMixin" - ], - "injectors": { - "defaultRequire": 1 + "required": true, + "minVersion": "0.8", + "package": "ambos.vanillafixes.mixin", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "DisplayListMixin", + "GuiMainMenuMixin" + ], + "client": [ + ], + "injectors": { + "defaultRequire": 1 } }