commit 1231b6dcabcc585bdffc4710ead8d83c4428f711 parent 2d7bf28452b04faaec8f282ae2bc3ce3c58f927c Author: Amb0s <ambos@disroot.org> Date: Wed, 10 Mar 2021 05:39:28 +0100 Changed mappings and fixed entity jittering Diffstat:
30 files changed, 370 insertions(+), 236 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -5,6 +5,10 @@ build/ out/ classes/ +# eclipse + +*.launch + # idea .idea/ @@ -22,4 +26,4 @@ bin/ # fabric -run/ -\ No newline at end of file +run/ diff --git a/README.md b/README.md @@ -1,6 +1,6 @@ # Vanilla Fixes -## Fixes (client only) +## Client side fixes * Skins * Capes @@ -14,11 +14,16 @@ * Fences * Stairs * Boats +* Entity jittering in multiplayer ## Installation -[Minecraft Cursed Legacy](https://minecraft-cursed-legacy.github.io/) +This mod doesn't need Cursed Legacy API or StationAPI. Only download the Cursed Fabric Loader [there](https://github.com/calmilamsy/Cursed-Fabric-MultiMC). ## Thanks SparklingComet, for their [Java Mojang API](https://github.com/SparklingComet/java-mojang-api). cutezyash, for letting me use [Megamod](https://github.com/OldHaven-Network/MegaMod-Mixins) code under LGPL. + +Oldmana, for originally finding the entity jittering fix. + +calmilamsy, for porting [it](https://github.com/calmilamsy/MPEntityPhysicsFix) to fabric. +\ No newline at end of file diff --git a/build.gradle b/build.gradle @@ -4,18 +4,22 @@ buildscript { jcenter() maven { name = "Fabric" - url = "https://maven.fabricmc.net/" + url = "https://maven.fabricmc.net/" } - maven { + maven { name = "Jitpack" url 'https://jitpack.io/' } } dependencies { - classpath 'com.github.Chocohead:Fabric-Loom:bbaa5d7' + classpath 'com.github.Chocohead:Fabric-Loom:e3d1762' } } +plugins { + id 'maven-publish' +} + apply plugin: "fabric-loom" sourceCompatibility = JavaVersion.VERSION_1_8 @@ -25,8 +29,20 @@ archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +idea { + module { + downloadJavadoc = true + } +} + +eclipse { + classpath { + downloadJavadoc = true + } +} + repositories { - maven { + maven { name = "Jitpack" url "https://jitpack.io/" } @@ -39,15 +55,17 @@ dependencies { // fabric loader requires log4j, guava, and gson implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.8.1' implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.8.1' + annotationProcessor group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.8.1' + annotationProcessor group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.8.1' implementation 'com.google.guava:guava:28.0-jre' implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6' - // mixin and fabric loader need asm 8 - implementation 'org.ow2.asm:asm:8.0' - implementation 'org.ow2.asm:asm-analysis:8.0' - implementation 'org.ow2.asm:asm-commons:8.0' - implementation 'org.ow2.asm:asm-tree:8.0' - implementation 'org.ow2.asm:asm-util:8.0' + // mixin and fabric loader need asm 9 + implementation 'org.ow2.asm:asm:9.0' + implementation 'org.ow2.asm:asm-analysis:9.0' + implementation 'org.ow2.asm:asm-commons:9.0' + implementation 'org.ow2.asm:asm-tree:9.0' + implementation 'org.ow2.asm:asm-util:9.0' // java mojang API include group: 'commons-codec', name: 'commons-codec', version: '1.14' @@ -61,17 +79,22 @@ dependencies { implementation 'com.github.SparklingComet:java-mojang-api:-SNAPSHOT' include 'com.github.SparklingComet:java-mojang-api:-SNAPSHOT' - //to change the versions see the gradle.properties file + // to change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings loom.fromCommit("minecraft-cursed-legacy/Plasma", "b464f27") {spec -> - spec.version = "b1.7.3-12" + mappings loom.fromCommit("calmilamsy/BIN-Mappings", "${project.yarn_mappings}") {spec -> + spec.version = "b1.7.3-${project.yarn_mappings}" } - modImplementation "com.github.minecraft-cursed-legacy:cursed-fabric-loader:${project.loader_version}" + // convenience stuff + // adds some useful annotations for data classes. does not add any dependencies + compileOnly 'org.projectlombok:lombok:1.18.16' + annotationProcessor 'org.projectlombok:lombok:1.18.16' + + // adds some useful annotations for miscellaneous uses. does not add any dependencies, though people without the lib will be missing some useful context hints. + compile 'org.jetbrains:annotations:16.0.2' - // API. You technically don't need it, but it's extremely useful for not having to write the same code in every mod. - modImplementation "com.github.minecraft-cursed-legacy:Cursed-Legacy-API:${project.api_version}" + modImplementation "com.github.minecraft-cursed-legacy:cursed-fabric-loader:${project.loader_version}" } processResources { @@ -101,3 +124,38 @@ task sourcesJar(type: Jar, dependsOn: classes) { classifier = "sources" from sourceSets.main.allSource } + +task javadocJar(type: Jar) { + from javadoc + classifier = 'javadoc' +} + +tasks.publishToMavenLocal.dependsOn(tasks.remapJar) + +publishing { + repositories { + mavenLocal() + } + + publications { + mavenJava(MavenPublication) { + artifactId project.archives_base_name + artifact ("${project.buildDir.absolutePath}/libs/${archivesBaseName}-${project.version}.jar") { + classifier null + builtBy remapJar + } + + artifact ("${project.buildDir.absolutePath}/libs/${archivesBaseName}-${project.version}-dev.jar") { + classifier 'dev' + builtBy remapJar + } + pom.withXml { + asNode().dependencies.dependency.each { dep -> + if(dep.artifactId.last().value().last().toLowerCase() in ["cursed-fabric-loader", "stationapi"]) { + assert dep.parent().remove(dep) + } + } + } + } + } +} diff --git a/gradle.properties b/gradle.properties @@ -1,10 +1,14 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G +# Disables gradle's buggy (in minecraft's case) daemon. +# Also makes builds more reliable and less likely to randomly fail. +org.gradle.daemon=false # Fabric Properties + # check these on https://fabricmc.net/use minecraft_version=b1.7.3 - loader_version=8f014a3 - api_version=0.6.0 + yarn_mappings=00548e7 + loader_version=671a1bb # Mod Properties mod_version = 1.0.2 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differ. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Aug 22 17:36:22 EDT 2016 +#Sun Jun 14 19:21:24 BST 2020 +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +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" -# 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 - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/src/main/java/ambos/vanillafixes/MinecraftUtil.java b/src/main/java/ambos/vanillafixes/MinecraftUtil.java @@ -11,7 +11,6 @@ import org.shanerx.mojang.PlayerProfile; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; -import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Arrays; import java.util.Optional; @@ -19,15 +18,13 @@ import java.util.Optional; public final class MinecraftUtil { private final static ArrayList<String> PROXY_URLs = new ArrayList<>(Arrays.asList( "http://resourceproxy.pymcl.net/MinecraftResources/", - "https://betacraft.pl/MinecraftResources/", - "http://mcresources.modification-station.net/MinecraftResources/" + "http://mcresources.modification-station.net/MinecraftResources/", + "https://betacraft.pl/MinecraftResources/" )); private static final Logger logger = LogManager.getLogger(MinecraftUtil.class); - private MinecraftUtil() { - - } + private MinecraftUtil() {} private static boolean isDown(String url) { try { @@ -50,10 +47,9 @@ public final class MinecraftUtil { JSONObject value = null; try { - Optional<PlayerProfile.Property> property = playerProfile.getProperties().stream() - .findFirst(); + Optional<PlayerProfile.Property> property = playerProfile.getProperties().stream().findFirst(); - if(property.isPresent()) { + if (property.isPresent()) { value = (JSONObject) new JSONParser() .parse(new String(Base64.decodeBase64(property.get().getValue()))); } @@ -65,11 +61,16 @@ public final class MinecraftUtil { return value != null && value.toJSONString().contains(Mojang.SkinType.SLIM.toString()); } + private static PlayerProfile getPlayerProfile(String username) { + Mojang mojang = new Mojang(); + String uuid = mojang.getUUIDOfUsername(username); + + return mojang.getPlayerProfile(uuid); + } + public static String getPlayerSkin(String username) { try { - Mojang mojang = new Mojang(); - String uuid = mojang.getUUIDOfUsername(username); - PlayerProfile playerProfile = mojang.getPlayerProfile(uuid); + PlayerProfile playerProfile = getPlayerProfile(username); Optional<URL> playerSkin = playerProfile.getTextures().flatMap(PlayerProfile.TexturesProperty::getSkin); if (playerSkin.isPresent() && !isSlim(playerProfile)) { @@ -85,9 +86,7 @@ public final class MinecraftUtil { public static String getPlayerCape(String username) { try { - Mojang mojang = new Mojang(); - String uuid = mojang.getUUIDOfUsername(username); - PlayerProfile playerProfile = mojang.getPlayerProfile(uuid); + PlayerProfile playerProfile = getPlayerProfile(username); Optional<URL> playerCape = playerProfile.getTextures().flatMap(PlayerProfile.TexturesProperty::getCape); if (playerCape.isPresent()) { @@ -111,5 +110,4 @@ public final class MinecraftUtil { return null; } -} - +} +\ No newline at end of file diff --git a/src/main/java/ambos/vanillafixes/mixin/AbstractClientPlayerMixin.java b/src/main/java/ambos/vanillafixes/mixin/AbstractClientPlayerMixin.java @@ -4,7 +4,7 @@ import ambos.vanillafixes.MinecraftUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.util.Session; import net.minecraft.entity.player.AbstractClientPlayer; -import net.minecraft.entity.player.Player; +import net.minecraft.entity.player.PlayerBase; import net.minecraft.level.Level; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(AbstractClientPlayer.class) -abstract class AbstractClientPlayerMixin extends Player { +abstract class AbstractClientPlayerMixin extends PlayerBase { private AbstractClientPlayerMixin(Level level) { super(level); } diff --git a/src/main/java/ambos/vanillafixes/mixin/BoatMixin.java b/src/main/java/ambos/vanillafixes/mixin/BoatMixin.java @@ -1,9 +1,9 @@ package ambos.vanillafixes.mixin; import net.minecraft.entity.Boat; -import net.minecraft.entity.Entity; -import net.minecraft.entity.ItemEntity; -import net.minecraft.item.ItemType; +import net.minecraft.entity.EntityBase; +import net.minecraft.entity.Item; +import net.minecraft.item.ItemBase; import net.minecraft.level.Level; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Boat.class) -abstract class BoatMixin extends Entity { +abstract class BoatMixin extends EntityBase { public boolean field_1624; public BoatMixin(Level level) { @@ -25,13 +25,13 @@ abstract class BoatMixin extends Entity { field_1624 = false; } - @Redirect(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Boat;dropItem(IIF)Lnet/minecraft/entity/ItemEntity;")) - private ItemEntity onDropItem(Boat boat, int i, int j, float f) { + @Redirect(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Boat;dropItem(IIF)Lnet/minecraft/entity/Item;")) + private Item onDropItem(Boat boat, int i, int j, float f) { return null; } @Inject(method = "damage", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Boat;remove()V"), cancellable = true) private void dropBoat(CallbackInfoReturnable<Boolean> ci) { - this.dropItem(ItemType.boat.id, 1, 0.0F); + this.dropItem(ItemBase.boat.id, 1, 0.0F); } } diff --git a/src/main/java/ambos/vanillafixes/mixin/DeathMixin.java b/src/main/java/ambos/vanillafixes/mixin/DeathMixin.java @@ -0,0 +1,18 @@ +package ambos.vanillafixes.mixin; + +import net.minecraft.client.gui.screen.ScreenBase; +import net.minecraft.client.gui.screen.ingame.Death; +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(Death.class) +final class DeathMixin extends ScreenBase { + @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/Death;drawTextWithShadowCentred(Lnet/minecraft/client/render/TextRenderer;Ljava/lang/String;III)V")) + private void changeDeathMessage(Args args) { + if (args.get(1) != "Game over!") { + args.set(1, "Score: §e" + minecraft.player.getScore()); + } + } +} diff --git a/src/main/java/ambos/vanillafixes/mixin/DeathScreenMixin.java b/src/main/java/ambos/vanillafixes/mixin/DeathScreenMixin.java @@ -1,18 +0,0 @@ -package ambos.vanillafixes.mixin; - -import net.minecraft.client.gui.Screen; -import net.minecraft.client.gui.screen.DeathScreen; -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(DeathScreen.class) -final class DeathScreenMixin extends Screen { - @ModifyArgs(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/DeathScreen;drawTextWithShadowCentred(Lnet/minecraft/client/render/TextRenderer;Ljava/lang/String;III)V")) - private void changeDeathMessage(Args args) { - if (args.get(1) != "Game over!") { - args.set(1, "Score: §e" + minecraft.player.method_481()); - } - } -} diff --git a/src/main/java/ambos/vanillafixes/mixin/EntityBaseMixin.java b/src/main/java/ambos/vanillafixes/mixin/EntityBaseMixin.java @@ -0,0 +1,30 @@ +package ambos.vanillafixes.mixin; + +import net.minecraft.entity.EntityBase; +import net.minecraft.entity.Living; +import net.minecraft.entity.player.PlayerBase; +import org.objectweb.asm.Opcodes; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(EntityBase.class) +final class EntityBaseMixin { + @Redirect(method = "move", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/EntityBase;x:D", opcode = Opcodes.PUTFIELD)) + private void fixX(EntityBase entityBase, double value) { + if (!entityBase.level.isClient || entityBase instanceof PlayerBase || !(entityBase instanceof Living)) + entityBase.x = value; + } + + @Redirect(method = "move", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/EntityBase;y:D", opcode = Opcodes.PUTFIELD)) + private void fixY(EntityBase entityBase, double value) { + if (!entityBase.level.isClient || entityBase instanceof PlayerBase || !(entityBase instanceof Living)) + entityBase.y = value; + } + + @Redirect(method = "move", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/EntityBase;z:D", opcode = Opcodes.PUTFIELD)) + private void fixZ(EntityBase entityBase, double value) { + if (!entityBase.level.isClient || entityBase instanceof PlayerBase || !(entityBase instanceof Living)) + entityBase.z = value; + } +} diff --git a/src/main/java/ambos/vanillafixes/mixin/FenceMixin.java b/src/main/java/ambos/vanillafixes/mixin/FenceMixin.java @@ -1,7 +1,7 @@ package ambos.vanillafixes.mixin; import net.minecraft.level.Level; -import net.minecraft.tile.Fence; +import net.minecraft.block.Fence; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; diff --git a/src/main/java/ambos/vanillafixes/mixin/HatchetMixin.java b/src/main/java/ambos/vanillafixes/mixin/HatchetMixin.java @@ -1,16 +1,17 @@ package ambos.vanillafixes.mixin; import net.minecraft.item.tool.Hatchet; -import net.minecraft.tile.Tile; +import net.minecraft.block.BlockBase; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @Mixin(Hatchet.class) final class HatchetMixin { @Shadow - private static Tile[] effectiveBlocks = new Tile[]{ - Tile.WOOD, Tile.BOOKSHELF, Tile.LOG, Tile.CHEST, Tile.WORKBENCH, - Tile.DOOR_WOOD, Tile.STAIRS_WOOD, Tile.WOODEN_PRESSURE_PLATE, Tile.FENCE, Tile.TRAPDOOR, Tile.JUKEBOX, - Tile.PUMPKIN, Tile.LIT_PUMPKIN, Tile.STANDING_SIGN, Tile.WALL_SIGN, Tile.NOTEBLOCK, Tile.LADDER + private static BlockBase[] effectiveBlocks = new BlockBase[]{ + BlockBase.WOOD, BlockBase.BOOKSHELF, BlockBase.LOG, BlockBase.CHEST, BlockBase.WORKBENCH, + BlockBase.WOOD_DOOR, BlockBase.WOOD_STAIRS, BlockBase.WOODEN_PRESSURE_PLATE, BlockBase.FENCE, + BlockBase.TRAPDOOR, BlockBase.JUKEBOX, BlockBase.PUMPKIN, BlockBase.JACK_O_LANTERN, BlockBase.STANDING_SIGN, + BlockBase.WALL_SIGN, BlockBase.NOTEBLOCK, BlockBase.LADDER }; } diff --git a/src/main/java/ambos/vanillafixes/mixin/MainMenuMixin.java b/src/main/java/ambos/vanillafixes/mixin/MainMenuMixin.java @@ -0,0 +1,16 @@ +package ambos.vanillafixes.mixin; + +import net.minecraft.client.gui.screen.ScreenBase; +import net.minecraft.client.gui.screen.menu.MainMenu; +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(MainMenu.class) +final class MainMenuMixin extends ScreenBase { + @Inject(method = "init", at = @At("HEAD")) + private void onInit(CallbackInfo ci) { + minecraft.isApplet = false; + } +} diff --git a/src/main/java/ambos/vanillafixes/mixin/PickaxeMixin.java b/src/main/java/ambos/vanillafixes/mixin/PickaxeMixin.java @@ -1,19 +1,20 @@ package ambos.vanillafixes.mixin; import net.minecraft.item.tool.Pickaxe; -import net.minecraft.tile.Tile; +import net.minecraft.block.BlockBase; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @Mixin(Pickaxe.class) final class PickaxeMixin { @Shadow - private static Tile[] effectiveBlocks = new Tile[]{ - Tile.STONEBRICK, Tile.DOUBLE_STONE_SLAB, Tile.STONE_SLAB, - Tile.STONE, Tile.SANDSTONE, Tile.MOSSY_COBBLESTONE, Tile.IRON_ORE, Tile.BLOCK_IRON, Tile.COAL_ORE, - Tile.BLOCK_GOLD, Tile.GOLD_ORE, Tile.ORE_DIAMOND, Tile.BLOCK_DIAMOND, Tile.ICE, Tile.NETHERRACK, - Tile.LAPIS_LAZULI_ORE, Tile.LAPIS_LAZULI_BLOCK, Tile.REDSTONE_ORE, Tile.REDSTONE_ORE_LIT, Tile.STAIRS_STONE, - Tile.DOOR_IRON, Tile.BRICK, Tile.FURNACE, Tile.FURNACE_LIT, Tile.DISPENSER, Tile.STONE_PRESSURE_PLATE, - Tile.RAIL, Tile.DETECTOR_RAIL, Tile.GOLDEN_RAIL + private static BlockBase[] effectiveBlocks = new BlockBase[]{ + BlockBase.BRICKS, BlockBase.DOUBLE_STONE_SLAB, BlockBase.STONE_SLAB, + BlockBase.STONE, BlockBase.SANDSTONE, BlockBase.MOSSY_COBBLESTONE, BlockBase.IRON_ORE, BlockBase.IRON_BLOCK, + BlockBase.COAL_ORE, BlockBase.GOLD_BLOCK, BlockBase.GOLD_ORE, BlockBase.DIAMOND_ORE, BlockBase.DIAMOND_BLOCK, + BlockBase.ICE, BlockBase.NETHERRACK, BlockBase.LAPIS_LAZULI_ORE, BlockBase.LAPIS_LAZULI_BLOCK, + BlockBase.REDSTONE_ORE, BlockBase.REDSTONE_ORE_LIT, BlockBase.COBBLESTONE_STAIRS, BlockBase.IRON_DOOR, + BlockBase.COBBLESTONE, BlockBase.FURNACE, BlockBase.FURNACE_LIT, BlockBase.DISPENSER, + BlockBase.STONE_PRESSURE_PLATE, BlockBase.RAIL, BlockBase.DETECTOR_RAIL, BlockBase.GOLDEN_RAIL }; } diff --git a/src/main/java/ambos/vanillafixes/mixin/PlayerBaseMixin.java b/src/main/java/ambos/vanillafixes/mixin/PlayerBaseMixin.java @@ -0,0 +1,30 @@ +package ambos.vanillafixes.mixin; + +import ambos.vanillafixes.MinecraftUtil; +import net.minecraft.entity.Living; +import net.minecraft.entity.player.PlayerBase; +import net.minecraft.level.Level; +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(PlayerBase.class) +final class PlayerBaseMixin extends Living { + @Shadow + public String playerCloakUrl; + + @Shadow + public String name; + + private PlayerBaseMixin(Level level) { + super(level); + } + + @Inject(method = "initCloak", at = @At("RETURN")) + private void onInitCloak(CallbackInfo ci) { + playerCloakUrl = MinecraftUtil.getPlayerCape(name); + cloakUrl = playerCloakUrl; + } +} diff --git a/src/main/java/ambos/vanillafixes/mixin/PlayerMixin.java b/src/main/java/ambos/vanillafixes/mixin/PlayerMixin.java @@ -1,30 +0,0 @@ -package ambos.vanillafixes.mixin; - -import ambos.vanillafixes.MinecraftUtil; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.Player; -import net.minecraft.level.Level; -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(Player.class) -final class PlayerMixin extends LivingEntity { - @Shadow - public String playerCloakUrl; - - @Shadow - public String name; - - private PlayerMixin(Level level) { - super(level); - } - - @Inject(method = "initCloak", at = @At("RETURN")) - private void onInitCloak(CallbackInfo ci) { - playerCloakUrl = MinecraftUtil.getPlayerCape(name); - cloakUrl = playerCloakUrl; - } -} diff --git a/src/main/java/ambos/vanillafixes/mixin/RemoteClientInteractionManagerMixin.java b/src/main/java/ambos/vanillafixes/mixin/RemoteClientInteractionManagerMixin.java @@ -0,0 +1,19 @@ +package ambos.vanillafixes.mixin; + +import net.minecraft.client.RemoteClientInteractionManager; +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(RemoteClientInteractionManager.class) +final class RemoteClientInteractionManagerMixin { + @Shadow + private int hitDelay; + + @Inject(method = "method_1721", at = @At("RETURN")) + private void changeHitDelay(CallbackInfo ci) { + hitDelay = 0; + } +} diff --git a/src/main/java/ambos/vanillafixes/mixin/RemoteClientPlayerMixin.java b/src/main/java/ambos/vanillafixes/mixin/RemoteClientPlayerMixin.java @@ -1,7 +1,7 @@ package ambos.vanillafixes.mixin; import ambos.vanillafixes.MinecraftUtil; -import net.minecraft.entity.player.Player; +import net.minecraft.entity.player.PlayerBase; import net.minecraft.entity.player.RemoteClientPlayer; import net.minecraft.level.Level; import org.spongepowered.asm.mixin.Mixin; @@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(RemoteClientPlayer.class) -abstract class RemoteClientPlayerMixin extends Player { +abstract class RemoteClientPlayerMixin extends PlayerBase { private RemoteClientPlayerMixin(Level level) { super(level); } diff --git a/src/main/java/ambos/vanillafixes/mixin/RenderListMixin.java b/src/main/java/ambos/vanillafixes/mixin/RenderListMixin.java @@ -0,0 +1,40 @@ +package ambos.vanillafixes.mixin; + +import net.minecraft.client.render.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(RenderList.class) +final class RenderListMixin { + private double field_2483_proxy; + private double field_2484_proxy; + private double field_2485_proxy; + + @Shadow + private int field_2480; + + @Shadow + private int field_2481; + + @Shadow + private int field_2482; + + @Inject(method = "method_1912", at = @At("RETURN")) + private void onMethod_1912(int var1, int var2, int var3, double var4, double var6, double var8, CallbackInfo ci) { + this.field_2483_proxy = var4; + this.field_2484_proxy = var6; + this.field_2485_proxy = var8; + } + + @ModifyArgs(method = "method_1909", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glTranslatef(FFF)V"), remap = false) + private void changeType(Args args) { + args.set(0, (float) ((double) this.field_2480 - this.field_2483_proxy)); + args.set(1, (float) ((double) this.field_2481 - this.field_2484_proxy)); + args.set(2, (float) ((double) this.field_2482 - this.field_2485_proxy)); + } +} diff --git a/src/main/java/ambos/vanillafixes/mixin/ResourceDownloadThreadMixin.java b/src/main/java/ambos/vanillafixes/mixin/ResourceDownloadThreadMixin.java @@ -1,15 +0,0 @@ -package ambos.vanillafixes.mixin; - -import ambos.vanillafixes.MinecraftUtil; -import net.minecraft.client.util.ResourceDownloadThread; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.Constant; -import org.spongepowered.asm.mixin.injection.ModifyConstant; - -@Mixin(ResourceDownloadThread.class) -final class ResourceDownloadThreadMixin { - @ModifyConstant(method = "run", constant = @Constant(stringValue = "http://s3.amazonaws.com/MinecraftResources/"), remap = false) - private String changeURL(String url) { - return MinecraftUtil.getResources(); - } -} diff --git a/src/main/java/ambos/vanillafixes/mixin/StairsMixin.java b/src/main/java/ambos/vanillafixes/mixin/StairsMixin.java @@ -1,9 +1,9 @@ package ambos.vanillafixes.mixin; import net.minecraft.level.Level; -import net.minecraft.tile.Stairs; -import net.minecraft.tile.Tile; -import net.minecraft.tile.material.Material; +import net.minecraft.block.Stairs; +import net.minecraft.block.BlockBase; +import net.minecraft.block.material.Material; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -13,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.Random; @Mixin(Stairs.class) -final class StairsMixin extends Tile { +final class StairsMixin extends BlockBase { private StairsMixin(int id, Material material) { super(id, material); } diff --git a/src/main/java/ambos/vanillafixes/mixin/ThreadDownloadResourcesMixin.java b/src/main/java/ambos/vanillafixes/mixin/ThreadDownloadResourcesMixin.java @@ -0,0 +1,15 @@ +package ambos.vanillafixes.mixin; + +import ambos.vanillafixes.MinecraftUtil; +import net.minecraft.client.util.ThreadDownloadResources; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +@Mixin(ThreadDownloadResources.class) +final class ThreadDownloadResourcesMixin { + @ModifyConstant(method = "run", constant = @Constant(stringValue = "http://s3.amazonaws.com/MinecraftResources/"), remap = false) + private String changeURL(String url) { + return MinecraftUtil.getResources(); + } +} diff --git a/src/main/java/ambos/vanillafixes/mixin/TitleScreenMixin.java b/src/main/java/ambos/vanillafixes/mixin/TitleScreenMixin.java @@ -1,16 +0,0 @@ -package ambos.vanillafixes.mixin; - -import net.minecraft.client.gui.Screen; -import net.minecraft.client.gui.screen.TitleScreen; -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(TitleScreen.class) -final class TitleScreenMixin extends Screen { - @Inject(method = "init", at = @At("HEAD")) - private void onInit(CallbackInfo ci) { - minecraft.isApplet = false; - } -} diff --git a/src/main/java/ambos/vanillafixes/mixin/class_472Mixin.java b/src/main/java/ambos/vanillafixes/mixin/class_472Mixin.java @@ -1,40 +0,0 @@ -package ambos.vanillafixes.mixin; - -import net.minecraft.class_472; -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(class_472.class) -final class class_472Mixin { - private double field_2483_proxy; - private double field_2484_proxy; - private double field_2485_proxy; - - @Shadow - private int field_2480; - - @Shadow - private int field_2481; - - @Shadow - private int field_2482; - - @Inject(method = "method_1912", at = @At("RETURN")) - private void onMethod_1912(int var1, int var2, int var3, double var4, double var6, double var8, CallbackInfo ci) { - this.field_2483_proxy = var4; - this.field_2484_proxy = var6; - this.field_2485_proxy = var8; - } - - @ModifyArgs(method = "method_1909", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glTranslatef(FFF)V"), remap = false) - private void changeType(Args args) { - args.set(0, (float) ((double) this.field_2480 - this.field_2483_proxy)); - args.set(1, (float) ((double) this.field_2481 - this.field_2484_proxy)); - args.set(2, (float) ((double) this.field_2482 - this.field_2485_proxy)); - } -} diff --git a/src/main/java/ambos/vanillafixes/mixin/class_520Mixin.java b/src/main/java/ambos/vanillafixes/mixin/class_520Mixin.java @@ -1,19 +0,0 @@ -package ambos.vanillafixes.mixin; - -import net.minecraft.class_520; -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(class_520.class) -final class class_520Mixin { - @Shadow - private int field_2187; - - @Inject(method = "method_1721", at = @At("RETURN")) - private void changeHitDelay(CallbackInfo ci) { - field_2187 = 0; - } -} diff --git a/src/main/resources/vanillafixes.mixins.json b/src/main/resources/vanillafixes.mixins.json @@ -8,19 +8,21 @@ "client": [ "AbstractClientPlayerMixin", "BoatMixin", - "class_472Mixin", - "class_520Mixin", "ClientPlayNetworkHandlerMixin", - "DeathScreenMixin", + "DeathMixin", + "EntityBaseMixin", "FenceMixin", "HatchetMixin", "LoginThreadMixin", + "MainMenuMixin", "MinecraftMixin", "PickaxeMixin", - "PlayerMixin", + "PlayerBaseMixin", + "RemoteClientInteractionManagerMixin", "RemoteClientPlayerMixin", - "ResourceDownloadThreadMixin", - "TitleScreenMixin" + "RenderListMixin", + "StairsMixin", + "ThreadDownloadResourcesMixin" ], "injectors": { "defaultRequire": 1