diff --git a/README.md b/README.md index 9f3e6d0d..cf066c56 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Fixes Chunk Regen due to StringTag writeUTF() not respecting readUTF() Limits * Required options: `false`,`true` * Categories: `CARPETFIXES`,`BUGFIX`,`CRASHFIX` * Additional notes: - * This fixes inventory duping using books and chunk regen using books. + * This fixes using books to dupe inventories, regen chunks, and vanilla tick freeze chunks. ## blockCollisionCheckFix Fixes incorrect block collision checks @@ -80,14 +80,6 @@ Makes it so that hoppers give block updates when placed while powered * Categories: `CARPETFIXES`,`BUGFIX` * Fixes: [2No2Name's video](https://www.youtube.com/watch?v=QVOONJ1OY44) -## worldgenIncorrectOrderFix -Fixes World Modifying tasks to be before decorations -* Type: `boolean` -* Default value: `false` -* Required options: `false`,`true` -* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` -* Fixes: [MC-610](https://bugs.mojang.com/browse/MC-610) - ## incorrectBounceLogicFix Fixes some entities not bouncing on slime blocks and getting stuck * Type: `boolean` @@ -218,14 +210,6 @@ Fixes Named Blocks not stacking due to useless RepairCost tag * Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` * Fixes: [MC-197473](https://bugs.mojang.com/browse/MC-197473) -## zombiePiglinTracingFix -Tracing the target to another dimension does not stop checking for visibility, so that many unnecessary chunks are loaded -* Type: `boolean` -* Default value: `false` -* Required options: `false`,`true` -* Categories: `CARPETFIXES`,`BUGFIX`,`CRASHFIX` -* By: *Hendrix-Shen* - ## drownedEnchantedTridentsFix Makes enchantments work on tridents thrown by drowned * Type: `boolean` @@ -243,39 +227,13 @@ Fixes target blocks being permanently powered when moved by pistons * Categories: `CARPETFIXES`,`BACKPORT` * Fixes: [MC-173244](https://bugs.mojang.com/browse/MC-173244) -## portalGeneralItemDupeFix -Fixes general item dupe using dolphins, and some other dimension change dupes -* Type: `boolean` -* Default value: `false` -* Required options: `false`,`true` -* Categories: `CARPETFIXES`,`BUGFIX`,`BACKPORT` - -## shulkerTeleportFix -Shulkers do not teleport correctly when going through a portal -* Type: `boolean` -* Default value: `false` -* Required options: `false`,`true` -* Categories: `CARPETFIXES`,`BUGFIX`,`BACKPORT` -* Fixes: [MC-139265](https://bugs.mojang.com/browse/MC-139265) in 21w03a -* By: *Hendrix-Shen* - -## drownedMemoryLeakFix -Fixes Drowned navigation causing memory leak/performance degradation -* Type: `boolean` -* Default value: `false` -* Required options: `false`,`true` -* Categories: `CARPETFIXES`,`BACKPORT`,`BUGFIX` -* Fixes: [MC-202246](https://bugs.mojang.com/browse/MC-202246) from 20w45a -* By: *Fallen-Breath* - -## shulkerBoxItemsDropContents -Backport dropping the contents of a Shulker Box item when its item entity is destroyed +## lightningRodPermanentlyPoweredFix +Fixes lightning rods being permanently powered when moved by pistons * Type: `boolean` -* Default value: `false` +* Default value: `true` * Required options: `false`,`true` * Categories: `CARPETFIXES`,`BACKPORT` -* Fixes: [MC-176615](https://bugs.mojang.com/browse/MC-176615) from 20w51a -* By: *Copetan* from *lunaar-carpet-addons* +* Fixes: [MC-203718](https://bugs.mojang.com/browse/MC-203718) ## oldFlintAndSteelBehavior Backport 1.12 flint and steel behavior. Flint and steel can be used for updating observers / buds @@ -291,9 +249,11 @@ Re-introduces multiplayer donkey/llama dupe bug based on disconnecting while rid * Type: `boolean` * Default value: `true` * Required options: `false`,`true` -* Categories: `CARPETFIXES`,`BUGFIX`,`BACKPORT` +* Categories: `CARPETFIXES`,`BUGFIX`,`BACKPORT`,`EXPERIMENTAL` * Fixes: Fixed [MC-181241](https://bugs.mojang.com/browse/MC-181241) from 18w05a * By: *whoImT* from *carpet-addons* +* Additional notes: + * This has not been tested in 1.17 and may not work! # From Carpet & Other Extensions ## lightningKillsDropsFix diff --git a/build.gradle b/build.gradle index d9273a6e..74a26fc6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.6-SNAPSHOT' + id 'fabric-loom' version '0.8-SNAPSHOT' id 'maven-publish' } @@ -9,8 +9,8 @@ repositories { } } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_16 +targetCompatibility = JavaVersion.VERSION_16 archivesBaseName = project.archives_base_name version = project.minecraft_version+'-'+project.mod_version @@ -24,8 +24,8 @@ dependencies { //to change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modCompile "net.fabricmc:fabric-loader:${project.loader_version}" - modCompile "carpet:fabric-carpet:${project.minecraft_version}-${project.carpet_core_version}" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation "carpet:fabric-carpet:${project.minecraft_version}-${project.carpet_core_version}" // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. // You may need to force-disable transitiveness on them. @@ -34,29 +34,27 @@ dependencies { processResources { inputs.property "version", project.version - from(sourceSets.main.resources.srcDirs) { - include "fabric.mod.json" + filesMatching("fabric.mod.json") { expand "version": project.version } - - from(sourceSets.main.resources.srcDirs) { - exclude "fabric.mod.json" - } } -// ensure that the encoding is set to UTF-8, no matter what the system default is -// this fixes some edge cases with special characters not displaying correctly -// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html -tasks.withType(JavaCompile) { - options.encoding = "UTF-8" +tasks.withType(JavaCompile).configureEach { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // Minecraft 1.17 (21w19a) upwards uses Java 16. + it.options.release = 16 } -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource +java { + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() } jar { diff --git a/gradle.properties b/gradle.properties index 0b3c0657..06fd0a4a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use or https://modmuss50.me/fabric.html - minecraft_version=1.16.5 - yarn_mappings=1.16.5+build.9 - loader_version=0.10.6+build.214 + minecraft_version=1.17 + yarn_mappings=1.17+build.6 + loader_version=0.11.3 # check available versions on maven for the given minecraft version you are using - carpet_core_version=1.4.26+v210210 + carpet_core_version=1.4.40+v210608 # Mod Properties - mod_version = 0.0.6 + mod_version = 0.0.7 maven_group = carpetfixes archives_base_name = carpetfixes diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..e708b1c0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4b7e1f3d..0f80bbf5 100644 --- 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-5.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 8e25e6c1..4f906e0c 100644 --- a/gradlew +++ b/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -125,10 +126,11 @@ 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"` # We build the pattern for arguments to be converted via cygpath @@ -154,19 +156,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 @@ -175,14 +177,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 index 9618d8d9..107acd32 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -29,6 +29,9 @@ 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="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/src/main/java/carpetfixes/CarpetFixesSettings.java b/src/main/java/carpetfixes/CarpetFixesSettings.java index 96c15b2e..b2e9e775 100644 --- a/src/main/java/carpetfixes/CarpetFixesSettings.java +++ b/src/main/java/carpetfixes/CarpetFixesSettings.java @@ -43,14 +43,6 @@ public enum PresetSettings { ) public static PresetSettings carpetFixesPreset = PresetSettings.CUSTOM; - //By FX - PR0CESS - @Rule( - desc = "Fixes World Modifying tasks to be before decorations [lakes]", - extra = {"Warning! This is extremely unstable and modifies vanilla mechanics. Should be enabled before stating the server!","Fixes [MC-610](https://bugs.mojang.com/browse/MC-610)"}, - category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} - ) - public static boolean worldgenIncorrectOrderFix = false; - //By FX - PR0CESS @Rule( desc = "End Crystals now explode when damaged from explosions. End Crystal chaining", @@ -262,14 +254,6 @@ public enum PresetSettings { ) public static boolean repairCostItemNotStackingFix = false; - //By Hendrix-Shen - @Rule( - desc = "Tracing the target to another dimension does not stop checking for visibility, so that many unnecessary chunks are loaded", - extra = "Fixes [MC-202249](https://bugs.mojang.com/browse/MC-202249)", - category = {CARPETFIXES,BUGFIX,CRASHFIX} - ) - public static boolean zombiePiglinTracingFix = false; - //By Skyrising @Rule( desc = "Makes enchantments work on tridents thrown by drowned", @@ -278,6 +262,14 @@ public enum PresetSettings { ) public static boolean drownedEnchantedTridentsFix = false; + //By FX - PR0CESS + @Rule( + desc = "Fixes general item dupe using dolphins, and some other dimension change dupes", + extra = "On by default, mojang has fixed this. Turning the rule off re-enables the dupe to work", + category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} + ) + public static boolean portalGeneralItemDupeFix = true; + /* @@ -297,34 +289,11 @@ public enum PresetSettings { //By FX - PR0CESS @Rule( - desc = "Fixes general item dupe using dolphins, and some other dimension change dupes", - category = {CARPETFIXES,BUGFIX,BACKPORT} - ) - public static boolean portalGeneralItemDupeFix = true; - - //By Hendrix-Shen - @Rule( - desc = "Shulkers do not teleport correctly when going through a portal.", - extra = "Fixed [MC-139265](https://bugs.mojang.com/browse/MC-139265) from 21w03a", - category = {CARPETFIXES,BUGFIX,BACKPORT} - ) - public static boolean shulkerTeleportFix = false; - - //By Fallen-Breath - @Rule( - desc = "Fixes Drowned navigation causing memory leak/performance degradation", - extra = "Fixed [MC-202246](https://bugs.mojang.com/browse/MC-202246) from 20w45a", - category = {CARPETFIXES,BACKPORT,BUGFIX} - ) - public static boolean drownedMemoryLeakFix = false; - - //By Copetan from lunaar-carpet-addons - @Rule( - desc = "Backport dropping the contents of a Shulker Box item when its item entity is destroyed", - extra = "Fixed [MC-176615](https://bugs.mojang.com/browse/MC-176615) from 20w51a", - category = {CARPETFIXES,BUGFIX,BACKPORT} + desc = "Fixes lightning rods being permanently powered when moved by pistons", + extra = "Fixes [MC-203718](https://bugs.mojang.com/browse/MC-203718)", + category = {CARPETFIXES,BACKPORT} ) - public static boolean shulkerBoxItemsDropContents = false; + public static boolean lightningRodPermanentlyPoweredFix = true; //By whoImT from carpet-addons @Rule( @@ -337,12 +306,11 @@ public enum PresetSettings { //By whoImT from carpet-addons @Rule( desc = "Re-introduces multiplayer donkey/llama dupe bug based on disconnecting while riding donkey/llama", - extra = "Fixed [MC-181241](https://bugs.mojang.com/browse/MC-181241) from 18w05a", - category = {CARPETFIXES,BUGFIX,BACKPORT} + extra = {"Fixed [MC-181241](https://bugs.mojang.com/browse/MC-181241) from 18w05a","This has not been tested in 1.17 and may not work!"}, + category = {CARPETFIXES,BUGFIX,BACKPORT,EXPERIMENTAL} ) public static boolean donkeyRidingDupeFix = true; - /* FABRIC-CARPET OVERRIDES diff --git a/src/main/java/carpetfixes/helpers/IDrownedEntity.java b/src/main/java/carpetfixes/helpers/IDrownedEntity.java deleted file mode 100644 index 415c6158..00000000 --- a/src/main/java/carpetfixes/helpers/IDrownedEntity.java +++ /dev/null @@ -1,7 +0,0 @@ -package carpetfixes.helpers; - -import net.minecraft.entity.ai.pathing.EntityNavigation; - -public interface IDrownedEntity { - EntityNavigation getInitialEntityNavigation(); -} diff --git a/src/main/java/carpetfixes/helpers/RulePresets.java b/src/main/java/carpetfixes/helpers/RulePresets.java index 38d6224f..7a7cbfd2 100644 --- a/src/main/java/carpetfixes/helpers/RulePresets.java +++ b/src/main/java/carpetfixes/helpers/RulePresets.java @@ -33,7 +33,7 @@ public static void runChangePresetRule(ServerCommandSource source, CarpetFixesSe public static boolean isStabilityRuleException(String name) { //List of rules which should count as stability even tho they don't fit the requirements - return name.equals("drownedMemoryLeakFix"); // || ... + return false; //name.equals("drownedMemoryLeakFix"); // || ... } public static void setAll(ServerCommandSource source) { diff --git a/src/main/java/carpetfixes/mixins/backports/AbstractFireBlock_flintAndSteelMixin.java b/src/main/java/carpetfixes/mixins/backports/AbstractFireBlock_flintAndSteelMixin.java index 98cb719f..b32eac35 100644 --- a/src/main/java/carpetfixes/mixins/backports/AbstractFireBlock_flintAndSteelMixin.java +++ b/src/main/java/carpetfixes/mixins/backports/AbstractFireBlock_flintAndSteelMixin.java @@ -12,7 +12,7 @@ @Mixin(AbstractFireBlock.class) public class AbstractFireBlock_flintAndSteelMixin { - @Inject(method = "method_30032", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;canPlaceAt(Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;)Z"), cancellable = true) + @Inject(method = "canPlaceAt", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;canPlaceAt(Lnet/minecraft/world/WorldView;Lnet/minecraft/util/math/BlockPos;)Z"), cancellable = true) private static void canPlaceAt(World world, BlockPos blockPos, Direction direction, CallbackInfoReturnable cir){ if(CarpetFixesSettings.oldFlintAndSteelBehavior) cir.setReturnValue(true); } diff --git a/src/main/java/carpetfixes/mixins/backports/PlayerManager_LlamaRidingDupeMixin.java b/src/main/java/carpetfixes/mixins/backports/PlayerManager_LlamaRidingDupeMixin.java index 85455888..1b769bc8 100644 --- a/src/main/java/carpetfixes/mixins/backports/PlayerManager_LlamaRidingDupeMixin.java +++ b/src/main/java/carpetfixes/mixins/backports/PlayerManager_LlamaRidingDupeMixin.java @@ -25,14 +25,12 @@ private boolean llamaDupe(ServerPlayerEntity serverPlayerEntity){ if (entity.hasPlayerRider()) { LOGGER.debug("Removing player mount"); serverPlayerEntity.stopRiding(); - serverPlayerEntity.getServerWorld().removeEntity(entity); - entity.removed = false; Entity entity2; - for(Iterator var4 = entity.getPassengersDeep().iterator(); var4.hasNext(); entity2.removed = false) { + for(Iterator var4 = entity.getPassengersDeep().iterator(); var4.hasNext();) { entity2 = (Entity)var4.next(); - serverPlayerEntity.getServerWorld().removeEntity(entity2); + entity2.discard(); } - serverPlayerEntity.getServerWorld().getChunk(serverPlayerEntity.chunkX, serverPlayerEntity.chunkZ).markDirty(); + serverPlayerEntity.getServerWorld().getChunk(serverPlayerEntity.getChunkPos().x, serverPlayerEntity.getChunkPos().z).markDirty(); } } return false; diff --git a/src/main/java/carpetfixes/mixins/blockFixes/LightningRodBlock_PermanentlyPoweredMixin.java b/src/main/java/carpetfixes/mixins/blockFixes/LightningRodBlock_PermanentlyPoweredMixin.java new file mode 100644 index 00000000..212277aa --- /dev/null +++ b/src/main/java/carpetfixes/mixins/blockFixes/LightningRodBlock_PermanentlyPoweredMixin.java @@ -0,0 +1,31 @@ +package carpetfixes.mixins.blockFixes; + +import carpetfixes.CarpetFixesSettings; +import net.minecraft.block.BlockState; +import net.minecraft.block.LightningRodBlock; +import net.minecraft.block.TargetBlock; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +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(LightningRodBlock.class) +public class LightningRodBlock_PermanentlyPoweredMixin { + + /** + * Make it so that the targetBlock does not do any check when added. Just + * like it use to be, so its movable while keeping its power level. We also + * need to prevent it from giving updates when removed. + */ + @Inject(method = "onBlockAdded(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)V", at = @At(value = "INVOKE"),cancellable = true) + public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify, CallbackInfo ci) { + if (CarpetFixesSettings.lightningRodPermanentlyPoweredFix) { ci.cancel(); } + } + + @Inject(method = "onStateReplaced(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)V", at = @At(value = "INVOKE"),cancellable = true) + public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify, CallbackInfo ci) { + if (CarpetFixesSettings.lightningRodPermanentlyPoweredFix) { ci.cancel(); } + } +} diff --git a/src/main/java/carpetfixes/mixins/redstoneFixes/TargetBlock_PermanentlyPoweredMixin.java b/src/main/java/carpetfixes/mixins/blockFixes/TargetBlock_PermanentlyPoweredMixin.java similarity index 96% rename from src/main/java/carpetfixes/mixins/redstoneFixes/TargetBlock_PermanentlyPoweredMixin.java rename to src/main/java/carpetfixes/mixins/blockFixes/TargetBlock_PermanentlyPoweredMixin.java index 0d974126..bf630cb7 100644 --- a/src/main/java/carpetfixes/mixins/redstoneFixes/TargetBlock_PermanentlyPoweredMixin.java +++ b/src/main/java/carpetfixes/mixins/blockFixes/TargetBlock_PermanentlyPoweredMixin.java @@ -1,4 +1,4 @@ -package carpetfixes.mixins.redstoneFixes; +package carpetfixes.mixins.blockFixes; import carpetfixes.CarpetFixesSettings; import net.minecraft.block.BlockState; diff --git a/src/main/java/carpetfixes/mixins/coreSystemFixes/Biome_featureOrderMixin.java b/src/main/java/carpetfixes/mixins/coreSystemFixes/Biome_featureOrderMixin.java deleted file mode 100644 index 7dd54bc7..00000000 --- a/src/main/java/carpetfixes/mixins/coreSystemFixes/Biome_featureOrderMixin.java +++ /dev/null @@ -1,41 +0,0 @@ -package carpetfixes.mixins.coreSystemFixes; - -import carpet.CarpetServer; -import carpetfixes.CarpetFixesSettings; -import net.minecraft.util.crash.CrashException; -import net.minecraft.util.crash.CrashReport; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ChunkRegion; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.gen.ChunkRandom; -import net.minecraft.world.gen.StructureAccessor; -import net.minecraft.world.gen.chunk.ChunkGenerator; -import net.minecraft.world.gen.feature.*; -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(Biome.class) -public class Biome_featureOrderMixin { - - /** - * Here we inject the lake feature before every other feature. This makes sure - * that vegetation is done after the lakes, so that no lakes replace the blocks - * below grass & other vegetation. - */ - @Inject( - method = "generateFeatureStep(Lnet/minecraft/world/gen/StructureAccessor;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Lnet/minecraft/world/ChunkRegion;JLnet/minecraft/world/gen/ChunkRandom;Lnet/minecraft/util/math/BlockPos;)V", - at = @At(value = "INVOKE", target = "Ljava/util/List;size()I") - ) - public void registerOverride(StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, ChunkRegion region, long populationSeed, ChunkRandom random, BlockPos pos, CallbackInfo ci) { - if (CarpetFixesSettings.worldgenIncorrectOrderFix) { - try { - new LakeFeature(SingleStateFeatureConfig.CODEC).generate(CarpetServer.minecraft_server.getOverworld(), chunkGenerator,random,pos,new SingleStateFeatureConfig(region.getBlockState(pos))); - } catch (Exception var22) { - CrashReport crashReport2 = CrashReport.create(var22, "Lakes Mixin - Feature placement"); - throw new CrashException(crashReport2); - } - } - } -} diff --git a/src/main/java/carpetfixes/mixins/coreSystemFixes/Feature_featureOrderMixin.java b/src/main/java/carpetfixes/mixins/coreSystemFixes/Feature_featureOrderMixin.java deleted file mode 100644 index ae4456d2..00000000 --- a/src/main/java/carpetfixes/mixins/coreSystemFixes/Feature_featureOrderMixin.java +++ /dev/null @@ -1,29 +0,0 @@ -package carpetfixes.mixins.coreSystemFixes; - -import carpetfixes.CarpetFixesSettings; -import net.minecraft.util.registry.Registry; -import net.minecraft.world.gen.feature.*; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(Feature.class) -public class Feature_featureOrderMixin { - /** - * Here we set the lake feature to be set to nothing, so that the injection - * of the lake feature at the beginning is the only lake feature done. I - * wish I could modify the code directly and just add a new group just for - * carvers that are not actually carvers but modify terrain. - */ - @Inject( - method = "register(Ljava/lang/String;Lnet/minecraft/world/gen/feature/Feature;)Lnet/minecraft/world/gen/feature/Feature;", - at = @At("HEAD"), - cancellable = true - ) - private static > void registerOverride(String name, F feature, CallbackInfoReturnable cir) { - if (CarpetFixesSettings.worldgenIncorrectOrderFix && name.equals("lake")) { - cir.setReturnValue((F) Registry.register(Registry.FEATURE, name, new NoOpFeature(DefaultFeatureConfig.CODEC))); - } - } -} diff --git a/src/main/java/carpetfixes/mixins/coreSystemFixes/ServerPlayNetworkHandler_vehicleFloatingMixin.java b/src/main/java/carpetfixes/mixins/coreSystemFixes/ServerPlayNetworkHandler_vehicleFloatingMixin.java index 374fe042..86eddd6a 100644 --- a/src/main/java/carpetfixes/mixins/coreSystemFixes/ServerPlayNetworkHandler_vehicleFloatingMixin.java +++ b/src/main/java/carpetfixes/mixins/coreSystemFixes/ServerPlayNetworkHandler_vehicleFloatingMixin.java @@ -3,6 +3,7 @@ import carpetfixes.CarpetFixesSettings; import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket; import net.minecraft.server.network.ServerPlayNetworkHandler; +import net.minecraft.server.network.ServerPlayerEntity; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -13,7 +14,7 @@ public class ServerPlayNetworkHandler_vehicleFloatingMixin { @Shadow private boolean floating; - @Shadow private boolean ridingEntity; + @Shadow public ServerPlayerEntity player; /** * You can get kicked for flying by mounding an entity after jumping, this is @@ -23,7 +24,7 @@ public class ServerPlayNetworkHandler_vehicleFloatingMixin { */ @Inject(method = "onVehicleMove(Lnet/minecraft/network/packet/c2s/play/VehicleMoveC2SPacket;)V", at = @At("RETURN")) public void IfVehicleMovedPlayerNotFlying(VehicleMoveC2SPacket packet, CallbackInfo ci){ - if (CarpetFixesSettings.mountingFlyingTooLongFix && this.ridingEntity) { + if (CarpetFixesSettings.mountingFlyingTooLongFix && this.player.hasVehicle() && this.player.getVehicle() != this.player) { this.floating = false; } } diff --git a/src/main/java/carpetfixes/mixins/coreSystemFixes/StringTag_ChunkRegenMixin.java b/src/main/java/carpetfixes/mixins/coreSystemFixes/StringTag_ChunkRegenMixin.java index 9d656ab5..3a149702 100644 --- a/src/main/java/carpetfixes/mixins/coreSystemFixes/StringTag_ChunkRegenMixin.java +++ b/src/main/java/carpetfixes/mixins/coreSystemFixes/StringTag_ChunkRegenMixin.java @@ -1,6 +1,5 @@ package carpetfixes.mixins.coreSystemFixes; -import net.minecraft.nbt.StringTag; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.spongepowered.asm.mixin.Final; @@ -13,8 +12,9 @@ import carpetfixes.CarpetFixesSettings; import java.io.DataOutput; +import net.minecraft.nbt.NbtString; -@Mixin(StringTag.class) +@Mixin(NbtString.class) public abstract class StringTag_ChunkRegenMixin { private static final Logger LOGGER = LogManager.getLogger(); @@ -34,9 +34,8 @@ private void respectReadLimitDuringWrite(DataOutput output, CallbackInfo ci) { int strlen = this.value.length(); if(strlen > 28501) { //Minimum number that could bypass limit int utflen = 0; - char c; for (int i = 0; i < strlen; i++) { - c = this.value.charAt(i); + char c = this.value.charAt(i); utflen += ((c >= 0x0001) && (c <= 0x007F)) ? 1 : (c <= 0x07FF) ? 2 : 3; if (utflen > 65535) { this.value = this.value.substring(0, i-2); diff --git a/src/main/java/carpetfixes/mixins/drownedMemoryLeak/DrownedEntity_drownedMemoryLeakAccessor.java b/src/main/java/carpetfixes/mixins/drownedMemoryLeak/DrownedEntity_drownedMemoryLeakAccessor.java deleted file mode 100644 index fa718653..00000000 --- a/src/main/java/carpetfixes/mixins/drownedMemoryLeak/DrownedEntity_drownedMemoryLeakAccessor.java +++ /dev/null @@ -1,13 +0,0 @@ -package carpetfixes.mixins.drownedMemoryLeak; - -import net.minecraft.entity.ai.pathing.MobNavigation; -import net.minecraft.entity.ai.pathing.SwimNavigation; -import net.minecraft.entity.mob.DrownedEntity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(DrownedEntity.class) -public interface DrownedEntity_drownedMemoryLeakAccessor { - @Accessor SwimNavigation getWaterNavigation(); - @Accessor MobNavigation getLandNavigation(); -} diff --git a/src/main/java/carpetfixes/mixins/drownedMemoryLeak/DrownedEntity_drownedMemoryLeakMixin.java b/src/main/java/carpetfixes/mixins/drownedMemoryLeak/DrownedEntity_drownedMemoryLeakMixin.java deleted file mode 100644 index c5a368e7..00000000 --- a/src/main/java/carpetfixes/mixins/drownedMemoryLeak/DrownedEntity_drownedMemoryLeakMixin.java +++ /dev/null @@ -1,29 +0,0 @@ -package carpetfixes.mixins.drownedMemoryLeak; - -import carpetfixes.helpers.IDrownedEntity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.mob.DrownedEntity; -import net.minecraft.entity.mob.ZombieEntity; -import net.minecraft.world.World; -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(DrownedEntity.class) -public abstract class DrownedEntity_drownedMemoryLeakMixin extends ZombieEntity implements IDrownedEntity { - private EntityNavigation initialEntityNavigation; - - public DrownedEntity_drownedMemoryLeakMixin(World world) { super(world); } - - @Inject(method = "", at = @At("TAIL")) - private void recordInitialNavigation(EntityType entityType, World world, CallbackInfo ci) { - this.initialEntityNavigation = this.getNavigation(); - } - - @Override - public EntityNavigation getInitialEntityNavigation() { - return this.initialEntityNavigation; - } -} diff --git a/src/main/java/carpetfixes/mixins/drownedMemoryLeak/ServerWorld_drownedMemoryLeakMixin.java b/src/main/java/carpetfixes/mixins/drownedMemoryLeak/ServerWorld_drownedMemoryLeakMixin.java deleted file mode 100644 index cefaa5aa..00000000 --- a/src/main/java/carpetfixes/mixins/drownedMemoryLeak/ServerWorld_drownedMemoryLeakMixin.java +++ /dev/null @@ -1,34 +0,0 @@ -package carpetfixes.mixins.drownedMemoryLeak; - -import carpetfixes.CarpetFixesSettings; -import carpetfixes.helpers.IDrownedEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.mob.DrownedEntity; -import net.minecraft.server.world.ServerWorld; -import org.spongepowered.asm.mixin.Final; -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; - -import java.util.Set; - -@Mixin(ServerWorld.class) -public abstract class ServerWorld_drownedMemoryLeakMixin { - @Shadow @Final private Set entityNavigations; - - /** - * Remove all possible navigations of drowned, stop memory leak - * Drowned might changed its navigation field sometimes, but thankfully its possible navigations are final fields - */ - @Inject(method = "unloadEntity", at = @At("TAIL")) - private void removeAllPossibleDrownedNavigations(Entity entity, CallbackInfo ci) { - if (CarpetFixesSettings.drownedMemoryLeakFix && entity instanceof DrownedEntity) { - this.entityNavigations.remove(((IDrownedEntity) entity).getInitialEntityNavigation()); - this.entityNavigations.remove(((DrownedEntity_drownedMemoryLeakAccessor) entity).getLandNavigation()); - this.entityNavigations.remove(((DrownedEntity_drownedMemoryLeakAccessor) entity).getWaterNavigation()); - } - } -} diff --git a/src/main/java/carpetfixes/mixins/dupeFixes/FallingBlockEntity_duplicationMixin.java b/src/main/java/carpetfixes/mixins/dupeFixes/FallingBlockEntity_duplicationMixin.java index 8d9c86a9..3335d739 100644 --- a/src/main/java/carpetfixes/mixins/dupeFixes/FallingBlockEntity_duplicationMixin.java +++ b/src/main/java/carpetfixes/mixins/dupeFixes/FallingBlockEntity_duplicationMixin.java @@ -21,10 +21,8 @@ public FallingBlockEntity_duplicationMixin(EntityType type, World world) { * Cancel the entity removal if the entity is already considered dead. This * prevents duplication of the falling block entity using portals */ - @Inject(method = "tick()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/FallingBlockEntity;remove()V"), cancellable = true) - private void cancelDupe(CallbackInfo ci) { - if(CarpetFixesSettings.fallingBlockDuplicationFix && !this.isAlive()) { - ci.cancel(); - } + @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/FallingBlockEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V"), cancellable = true) + public void cancelDupe(CallbackInfo ci) { + if(CarpetFixesSettings.fallingBlockDuplicationFix && this.isRemoved()) { ci.cancel(); } } } diff --git a/src/main/java/carpetfixes/mixins/dupeFixes/MobEntity_portalGeneralItemMixin.java b/src/main/java/carpetfixes/mixins/dupeFixes/MobEntity_portalGeneralItemMixin.java index 7a06b374..ce744b67 100644 --- a/src/main/java/carpetfixes/mixins/dupeFixes/MobEntity_portalGeneralItemMixin.java +++ b/src/main/java/carpetfixes/mixins/dupeFixes/MobEntity_portalGeneralItemMixin.java @@ -11,17 +11,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(MobEntity.class) -abstract class MobEntity_portalGeneralItemMixin extends LivingEntity { +public abstract class MobEntity_portalGeneralItemMixin extends LivingEntity { protected MobEntity_portalGeneralItemMixin(EntityType entityType, World world) { super(entityType, world); } /** - * Set all stack counts to 0 when changing dimension. This makes absolutely - * sure that no item can be duped while changing dimension. + * Remove the part where it sets all stack counts to 0, allows for some + * interesting general item dupes to work. */ - @Inject(method= "method_30076()V",at=@At("RETURN")) - protected void stopGeneralItemDupes(CallbackInfo ci) { + @Inject(method="removeFromDimension",at=@At(value="INVOKE",target="Lnet/minecraft/entity/mob/MobEntity;getItemsEquipped()Ljava/lang/Iterable;"), cancellable = true) + protected void reEnableGeneralItemDupe(CallbackInfo ci) { if (CarpetFixesSettings.portalGeneralItemDupeFix) { - this.getItemsEquipped().forEach(lvt0 -> lvt0.setCount(0)); + ci.cancel(); } } -} +} \ No newline at end of file diff --git a/src/main/java/carpetfixes/mixins/dupeFixes/PistonBlock_tntDupingFixMixin.java b/src/main/java/carpetfixes/mixins/dupeFixes/PistonBlock_tntDupingFixMixin.java index c438af94..43447e22 100644 --- a/src/main/java/carpetfixes/mixins/dupeFixes/PistonBlock_tntDupingFixMixin.java +++ b/src/main/java/carpetfixes/mixins/dupeFixes/PistonBlock_tntDupingFixMixin.java @@ -39,7 +39,7 @@ public abstract class PistonBlock_tntDupingFixMixin { slice = @Slice( from = @At( value = "INVOKE", - target = "Lnet/minecraft/block/Block;hasBlockEntity()Z" + target = "Lnet/minecraft/block/BlockState;hasBlockEntity()Z" ) ), at = @At( diff --git a/src/main/java/carpetfixes/mixins/entityFixes/EntityAccessorMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/EntityAccessorMixin.java deleted file mode 100644 index bd387e1d..00000000 --- a/src/main/java/carpetfixes/mixins/entityFixes/EntityAccessorMixin.java +++ /dev/null @@ -1,23 +0,0 @@ -package carpetfixes.mixins.entityFixes; - -import net.minecraft.entity.Entity; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(Entity.class) -public interface EntityAccessorMixin { - - @Accessor("world") - World accessorGetWorld(); - - @Invoker("getX") - double invokerGetX(); - - @Invoker("getY") - double invokerGetY(); - - @Invoker("getZ") - double invokerGetZ(); -} \ No newline at end of file diff --git a/src/main/java/carpetfixes/mixins/entityFixes/Entity_blockCollisionMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/Entity_blockCollisionMixin.java index cd5692f7..caa3be68 100644 --- a/src/main/java/carpetfixes/mixins/entityFixes/Entity_blockCollisionMixin.java +++ b/src/main/java/carpetfixes/mixins/entityFixes/Entity_blockCollisionMixin.java @@ -26,7 +26,7 @@ public abstract class Entity_blockCollisionMixin { @Redirect( method = "move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V", - at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;checkBlockCollision()V") + at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;tryCheckBlockCollision()V") ) protected void onEntityCollision(Entity entity) { first = true; diff --git a/src/main/java/carpetfixes/mixins/entityFixes/Entity_directionalBlockSlowdownMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/Entity_directionalBlockSlowdownMixin.java index 5e6425c0..790916f2 100644 --- a/src/main/java/carpetfixes/mixins/entityFixes/Entity_directionalBlockSlowdownMixin.java +++ b/src/main/java/carpetfixes/mixins/entityFixes/Entity_directionalBlockSlowdownMixin.java @@ -24,11 +24,9 @@ public class Entity_directionalBlockSlowdownMixin { public void slowMovement(BlockState state, Vec3d m, CallbackInfo ci) { if (CarpetFixesSettings.directionalBlockSlowdownFix) { this.fallDistance = 0.0F; - this.movementMultiplier = new Vec3d( - this.movementMultiplier.x > 0 ? Math.min(this.movementMultiplier.x, m.x) : m.x, - this.movementMultiplier.y > 0 ? Math.min(this.movementMultiplier.y, m.y) : m.y, - this.movementMultiplier.z > 0 ? Math.min(this.movementMultiplier.z, m.z) : m.z - ); + if (this.movementMultiplier.length() > 0.0) { + this.movementMultiplier = new Vec3d(Math.min(this.movementMultiplier.x, m.x), Math.min(this.movementMultiplier.y, m.y), Math.min(this.movementMultiplier.z, m.z)); + } ci.cancel(); } } diff --git a/src/main/java/carpetfixes/mixins/entityFixes/LivingEntity_VisibilityCheckMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/LivingEntity_VisibilityCheckMixin.java deleted file mode 100644 index 51acdc20..00000000 --- a/src/main/java/carpetfixes/mixins/entityFixes/LivingEntity_VisibilityCheckMixin.java +++ /dev/null @@ -1,33 +0,0 @@ -package carpetfixes.mixins.entityFixes; - -import carpetfixes.CarpetFixesSettings; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(LivingEntity.class) -public abstract class LivingEntity_VisibilityCheckMixin extends Entity { - public LivingEntity_VisibilityCheckMixin(EntityType type, World world) { - super(type, world); - } - - @Inject( - method = "canSee", - at = @At( - value = "HEAD" - ), - cancellable = true - ) - private void onVisibilityCheck(Entity entity, CallbackInfoReturnable cir) { - if (CarpetFixesSettings.zombiePiglinTracingFix) { - if (entity.world != this.world) { - cir.setReturnValue(false); - } - } - } -} diff --git a/src/main/java/carpetfixes/mixins/entityFixes/LivingEntity_sleepingKillsMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/LivingEntity_sleepingKillsMixin.java index d127e58d..6d6898e2 100644 --- a/src/main/java/carpetfixes/mixins/entityFixes/LivingEntity_sleepingKillsMixin.java +++ b/src/main/java/carpetfixes/mixins/entityFixes/LivingEntity_sleepingKillsMixin.java @@ -22,8 +22,6 @@ public abstract class LivingEntity_sleepingKillsMixin extends Entity { */ @Inject(method= "setPositionInBed(Lnet/minecraft/util/math/BlockPos;)V",at=@At("HEAD")) private void saferSleep(BlockPos pos, CallbackInfo ci) { - if (CarpetFixesSettings.sleepingDelaysFallDamageFix) { - this.fallDistance = 0.0F; - } + if (CarpetFixesSettings.sleepingDelaysFallDamageFix) { this.fallDistance = 0.0F; } } } diff --git a/src/main/java/carpetfixes/mixins/entityFixes/ShulkerEntity_CustomDataMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/ShulkerEntity_CustomDataMixin.java deleted file mode 100644 index 74a03e83..00000000 --- a/src/main/java/carpetfixes/mixins/entityFixes/ShulkerEntity_CustomDataMixin.java +++ /dev/null @@ -1,26 +0,0 @@ -package carpetfixes.mixins.entityFixes; - -import carpetfixes.CarpetFixesSettings; -import net.minecraft.entity.mob.ShulkerEntity; -import net.minecraft.nbt.CompoundTag; -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(ShulkerEntity.class) -public class ShulkerEntity_CustomDataMixin { - @Inject( - method = "writeCustomDataToTag", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/entity/mob/ShulkerEntity;getAttachedBlock()Lnet/minecraft/util/math/BlockPos;" - ), - cancellable = true - ) - private void onWriteCustomDataToTag(CompoundTag tag, CallbackInfo ci) { - if (CarpetFixesSettings.shulkerTeleportFix) { - ci.cancel(); - } - } -} diff --git a/src/main/java/carpetfixes/mixins/entityFixes/TntEntity_netherPortalMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/TntEntity_netherPortalMixin.java index bf9999da..ba04fa1a 100644 --- a/src/main/java/carpetfixes/mixins/entityFixes/TntEntity_netherPortalMixin.java +++ b/src/main/java/carpetfixes/mixins/entityFixes/TntEntity_netherPortalMixin.java @@ -21,8 +21,6 @@ public abstract class TntEntity_netherPortalMixin extends Entity { */ @Inject(method= "tick()V",at=@At("HEAD")) public void tickNetherPortal(CallbackInfo ci) { - if (CarpetFixesSettings.tntCantUseNetherPortalsFix) { - this.tickNetherPortal(); - } + if (CarpetFixesSettings.tntCantUseNetherPortalsFix) { this.tickNetherPortal(); } } } diff --git a/src/main/java/carpetfixes/mixins/itemFixes/ItemEntity_lightningKillsDropsMixin.java b/src/main/java/carpetfixes/mixins/itemFixes/ItemEntity_lightningKillsDropsMixin.java index 85033564..bbaa0504 100644 --- a/src/main/java/carpetfixes/mixins/itemFixes/ItemEntity_lightningKillsDropsMixin.java +++ b/src/main/java/carpetfixes/mixins/itemFixes/ItemEntity_lightningKillsDropsMixin.java @@ -12,7 +12,7 @@ @Mixin(ItemEntity.class) public abstract class ItemEntity_lightningKillsDropsMixin extends Entity { - @Shadow private int age; + @Shadow private int itemAge; public ItemEntity_lightningKillsDropsMixin(EntityType type, World world) { super(type, world); @@ -27,7 +27,7 @@ public ItemEntity_lightningKillsDropsMixin(EntityType type, World world) { @Override public void onStruckByLightning(ServerWorld world, LightningEntity lightning) { if (CarpetFixesSettings.lightningKillsDropsFix) { - if (this.age > 8) { + if (this.itemAge > 8) { super.onStruckByLightning(world, lightning); } } else { diff --git a/src/main/java/carpetfixes/mixins/itemFixes/ItemEntity_shulkerDroppingMixin.java b/src/main/java/carpetfixes/mixins/itemFixes/ItemEntity_shulkerDroppingMixin.java deleted file mode 100644 index d6b0254f..00000000 --- a/src/main/java/carpetfixes/mixins/itemFixes/ItemEntity_shulkerDroppingMixin.java +++ /dev/null @@ -1,49 +0,0 @@ -package carpetfixes.mixins.itemFixes; - -import carpetfixes.CarpetFixesSettings; -import carpetfixes.mixins.entityFixes.EntityAccessorMixin; -import net.minecraft.block.ShulkerBoxBlock; -import net.minecraft.entity.ItemEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.world.World; -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.CallbackInfoReturnable; - -import java.util.stream.Stream; - -@Mixin(ItemEntity.class) -public abstract class ItemEntity_shulkerDroppingMixin implements EntityAccessorMixin { - @Shadow - public abstract ItemStack getStack(); - - @Inject( - method = "damage", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/entity/ItemEntity;remove()V" - ) - ) - public void onKilled(CallbackInfoReturnable cir) { - if (CarpetFixesSettings.shulkerBoxItemsDropContents - && (this.getStack().getItem() instanceof BlockItem) - && (((BlockItem) this.getStack().getItem()).getBlock() instanceof ShulkerBoxBlock)) { - CompoundTag compoundTag = this.getStack().getTag(); - if (compoundTag != null) { - ListTag listTag = compoundTag.getCompound("BlockEntityTag").getList("Items", 10); - Stream stream = listTag.stream().map(CompoundTag.class::cast).map(ItemStack::fromTag); - World world = this.accessorGetWorld(); - if (!world.isClient) - stream.forEach((itemStack) -> - world.spawnEntity(new ItemEntity(world, this.invokerGetX(), this.invokerGetY(), - this.invokerGetZ(), itemStack)) - ); - } - } - } -} diff --git a/src/main/java/carpetfixes/mixins/itemFixes/ItemStack_repairCostMixin.java b/src/main/java/carpetfixes/mixins/itemFixes/ItemStack_repairCostMixin.java index a075b363..2ef82ac0 100644 --- a/src/main/java/carpetfixes/mixins/itemFixes/ItemStack_repairCostMixin.java +++ b/src/main/java/carpetfixes/mixins/itemFixes/ItemStack_repairCostMixin.java @@ -2,7 +2,7 @@ import carpetfixes.CarpetFixesSettings; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtCompound; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -13,7 +13,7 @@ public class ItemStack_repairCostMixin { @Shadow public boolean hasTag() { return false; } - @Shadow private CompoundTag tag; + @Shadow private NbtCompound tag; private int getHideFlags() { return this.hasTag() && this.tag.contains("HideFlags", 99) ? this.tag.getInt("HideFlags") : 0; diff --git a/src/main/resources/carpetfixes.mixins.json b/src/main/resources/carpetfixes.mixins.json index 703c89de..5b83d641 100644 --- a/src/main/resources/carpetfixes.mixins.json +++ b/src/main/resources/carpetfixes.mixins.json @@ -1,26 +1,23 @@ { "required": true, "package": "carpetfixes.mixins", - "compatibilityLevel": "JAVA_8", + "compatibilityLevel": "JAVA_16", "mixins": [ "backports.AbstractFireBlock_flintAndSteelMixin", "backports.PlayerManager_LlamaRidingDupeMixin", + "blockFixes.LightningRodBlock_PermanentlyPoweredMixin", "blockFixes.SlimeBlock_incorrectLogicMixin", + "blockFixes.TargetBlock_PermanentlyPoweredMixin", "blockUpdates.AbstractRailBlock_invalidUpdateMixin", "blockUpdates.AbstractRailBlock_missingUpdateAfterPushMixin", "blockUpdates.AbstractRailBlock_missingUpdateOnPushMixin", "blockUpdates.HopperBlock_MissingUpdateMixin", "blockUpdates.SpongeBlock_MissingUpdateMixin", "blockUpdates.World_blockUpdateOrderMixin", - "coreSystemFixes.Biome_featureOrderMixin", - "coreSystemFixes.Feature_featureOrderMixin", "coreSystemFixes.ServerPlayNetworkHandler_vehicleFloatingMixin", "coreSystemFixes.ServerWorld_spawnChunksMixin", "coreSystemFixes.StringTag_ChunkRegenMixin", "coreSystemFixes.TheEndBiomeSource_endVoidMixin", - "drownedMemoryLeak.DrownedEntity_drownedMemoryLeakAccessor", - "drownedMemoryLeak.DrownedEntity_drownedMemoryLeakMixin", - "drownedMemoryLeak.ServerWorld_drownedMemoryLeakMixin", "dupeFixes.AbstractRailBlock_duplicationMixin", "dupeFixes.FallingBlockEntity_duplicationMixin", "dupeFixes.MobEntity_portalGeneralItemMixin", @@ -32,19 +29,14 @@ "entityFixes.Entity_blockCollisionMixin", "entityFixes.Entity_directionalBlockSlowdownMixin", "entityFixes.Entity_incorrectLogicMixin", - "entityFixes.EntityAccessorMixin", "entityFixes.FallingBlockEntity_netherPortalMixin", - "itemFixes.ItemEntity_lightningKillsDropsMixin", - "itemFixes.ItemEntity_shulkerDroppingMixin", "entityFixes.LivingEntity_sleepingKillsMixin", - "entityFixes.LivingEntity_VisibilityCheckMixin", "entityFixes.MobEntity_leashUpdateOrderMixin", - "entityFixes.ShulkerEntity_CustomDataMixin", "entityFixes.TntEntity_netherPortalMixin", + "itemFixes.ItemEntity_lightningKillsDropsMixin", "itemFixes.ItemStack_repairCostMixin", "redstoneFixes.AbstractRedstoneGateBlock_repeaterPriorityMixin", "redstoneFixes.PistonBlock_doubleRetractionMixin", - "redstoneFixes.TargetBlock_PermanentlyPoweredMixin", "redstoneFixes.World_ComparatorNotUpdatingMixin" ], "injectors": { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 47e50fdc..92a78d24 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -32,9 +32,10 @@ ], "accessWidener" : "carpetfixes.accesswidener", "depends": { - "minecraft": "1.16.x", - "fabricloader": ">=0.10.0", - "carpet": ">=1.4.26" + "minecraft": "1.17.x", + "fabricloader": ">=0.11.3", + "carpet": ">=1.4.26", + "java": ">=16" }, "custom": { "modmenu": {