diff --git a/README.md b/README.md index b3160e9e..0abc9b58 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ Fixes Chunk Regen due to StringTag writeUTF() not respecting readUTF() Limits * Default value: `false` * Required options: `false`,`true` * Categories: `CARPETFIXES`,`BUGFIX`,`CRASHFIX` +* Additional notes: + * This fixes inventory duping using books and chunk regen using books. ## blockCollisionCheckFix Fixes incorrect block collision checks @@ -78,12 +80,69 @@ Fixes World Modifying tasks to be before decorations * Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` * Fixes: [MC-610](https://bugs.mojang.com/browse/MC-610) -## updateSuppressionFix -Prevents update suppression from working! Original concept by: *Carpet-TCTC-Addition* +## incorrectBounceLogicFix +Fixes some entities not bouncing on slime blocks and getting stuck * Type: `boolean` * Default value: `false` * Required options: `false`,`true` -* Categories: `CARPETFIXES`,`BUGFIX`,`CRASHFIX` +* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` +* Fixes: [MC-216985](https://bugs.mojang.com/browse/MC-216985) + +## incorrectBubbleColumnLogicFix +Fixes some entities getting stuck in bubble columns +* Type: `boolean` +* Default value: `false` +* Required options: `false`,`true` +* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` +* Fixes: [MC-207866](https://bugs.mojang.com/browse/MC-207866) + +## directionalBlockSlowdownFix +Fixes movement slowdown being calculated based on last block in search. Uses the slowest value instead +* Type: `boolean` +* Default value: `false` +* Required options: `false`,`true` +* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` +* Fixes: [MC-202654](https://bugs.mojang.com/browse/MC-202654) + +## catsBreakLeadsDuringGiftFix +Fixes cats sometimes breaking there leads after giving a gift +* Type: `boolean` +* Default value: `false` +* Required options: `false`,`true` +* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` +* Fixes: [MC-202607](https://bugs.mojang.com/browse/MC-202607) + +## endermanDontUpdateOnPlaceFix +Fixes enderman not updating the block they place correctly +* Type: `boolean` +* Default value: `false` +* Required options: `false`,`true` +* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` +* Fixes: [MC-183054](https://bugs.mojang.com/browse/MC-183054) + +## railInvalidUpdateOnPushFix +Fixes rails updating other rails before checking if they are in a valid location +* Type: `boolean` +* Default value: `false` +* Required options: `false`,`true` +* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` +* Fixes: [MC-174864](https://bugs.mojang.com/browse/MC-174864) + +## endVoidRingsFix +Fixes the bug which causes there to be void rings (empty chunks) in the end +* Type: `boolean` +* Default value: `false` +* Required options: `false`,`true` +* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` +* Fixes: [MC-159283](https://bugs.mojang.com/browse/MC-159283) + +## mountingFlyingTooLongFix +Fixes getting kicked for flying too long when jumping and riding an entity +* Type: `boolean` +* Default value: `false` +* Required options: `false`,`true` +* Categories: `CARPETFIXES`,`BUGFIX`,`EXPERIMENTAL` +* Fixes: [MC-98727](https://bugs.mojang.com/browse/MC-98727) ## zombiePiglinTracingFix Tracing the target to another dimension does not stop checking for visibility, so that many unnecessary chunks are loaded diff --git a/src/main/java/carpetfixes/CarpetFixesSettings.java b/src/main/java/carpetfixes/CarpetFixesSettings.java index 75d2d9db..84144c15 100644 --- a/src/main/java/carpetfixes/CarpetFixesSettings.java +++ b/src/main/java/carpetfixes/CarpetFixesSettings.java @@ -28,6 +28,8 @@ public enum PresetSettings { CUSTOM //Default (Does not get checked) } + //Add your name above the rules so people know who to contact about changing the code. E.x. By FX - PR0CESS + //By FX - PR0CESS @Rule( desc = "This rule allows you to change all Carpet-Fixes rules at the same time!", @@ -86,7 +88,7 @@ public enum PresetSettings { //By FX - PR0CESS @Rule( - desc = "Fixes incorrect block collision checks", + desc = "Fixes incorrect block collision checks for players", extra = "Fixes [MC-123364](https://bugs.mojang.com/browse/MC-123364)", category = {CARPETFIXES,BUGFIX} ) @@ -117,11 +119,76 @@ public enum PresetSettings { public static boolean comparatorUpdateFix = false; //by FX - PR0CESS + /* Not working as Intended, needs a rewrite @Rule( desc = "Prevents update suppression from working! Original concept by: Carpet-TCTC-Addition", category = {CARPETFIXES,BUGFIX,CRASHFIX} ) - public static boolean updateSuppressionFix = false; + public static boolean updateSuppressionFix = false;*/ + + //by FX - PR0CESS + @Rule( + desc = "Fixes some entities not bouncing on slime blocks and getting stuck", + extra = "Fixes [MC-216985](https://bugs.mojang.com/browse/MC-216985)", + category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} + ) + public static boolean incorrectBounceLogicFix = false; + + //by FX - PR0CESS + @Rule( + desc = "Fixes some entities getting stuck in bubble columns", + extra = "Fixes [MC-207866](https://bugs.mojang.com/browse/MC-207866)", + category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} + ) + public static boolean incorrectBubbleColumnLogicFix = false; + + //by FX - PR0CESS + @Rule( + desc = "Fixes movement slowdown being calculated based on last block in search. Uses the slowest value instead", + extra = "Fixes [MC-202654](https://bugs.mojang.com/browse/MC-202654)", + category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} + ) + public static boolean directionalBlockSlowdownFix = false; + + //by FX - PR0CESS + @Rule( + desc = "Fixes cats sometimes breaking there leads after giving a gift", + extra = "Fixes [MC-202607](https://bugs.mojang.com/browse/MC-202607)", + category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} + ) + public static boolean catsBreakLeadsDuringGiftFix = false; + + //by FX - PR0CESS + @Rule( + desc = "Fixes enderman not updating the block they place correctly", + extra = "Fixes [MC-183054](https://bugs.mojang.com/browse/MC-183054)", + category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} + ) + public static boolean endermanDontUpdateOnPlaceFix = false; + + //by FX - PR0CESS + @Rule( + desc = "Fixes rails updating other rails before checking if they are in a valid location", + extra = "Fixes [MC-174864](https://bugs.mojang.com/browse/MC-174864)", + category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} + ) + public static boolean railInvalidUpdateOnPushFix = false; + + //by FX - PR0CESS + @Rule( + desc = "Fixes the bug which causes there to be void rings (empty chunks) in the end", + extra = "Fixes [MC-159283](https://bugs.mojang.com/browse/MC-159283)", + category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} + ) + public static boolean endVoidRingsFix = false; + + //by FX - PR0CESS + @Rule( + desc = "Fixes getting kicked for flying too long when jumping and riding an entity", + extra = "Fixes [MC-98727](https://bugs.mojang.com/browse/MC-98727)", + category = {CARPETFIXES,BUGFIX,EXPERIMENTAL} + ) + public static boolean mountingFlyingTooLongFix = false; //By Hendrix-Shen @Rule( diff --git a/src/main/java/carpetfixes/mixins/blockFixes/SlimeBlock_incorrectLogicMixin.java b/src/main/java/carpetfixes/mixins/blockFixes/SlimeBlock_incorrectLogicMixin.java new file mode 100644 index 00000000..29dcdc1f --- /dev/null +++ b/src/main/java/carpetfixes/mixins/blockFixes/SlimeBlock_incorrectLogicMixin.java @@ -0,0 +1,20 @@ +package carpetfixes.mixins.blockFixes; + +import carpetfixes.CarpetFixesSettings; +import net.minecraft.block.SlimeBlock; +import net.minecraft.entity.Entity; +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(SlimeBlock.class) +public class SlimeBlock_incorrectLogicMixin { + + @Inject(method = "bounce(Lnet/minecraft/entity/Entity;)V", at = @At(value="INVOKE", target="Lnet/minecraft/entity/Entity;setVelocity(DDD)V")) + public void entityHittingSlimeBlockBeLike(Entity entity, CallbackInfo ci){ + if (CarpetFixesSettings.incorrectBounceLogicFix) { + entity.setOnGround(entity.getVelocity().y > -0.15); + } + } +} diff --git a/src/main/java/carpetfixes/mixins/blockUpdates/AbstractRailBlock_invalidUpdateMixin.java b/src/main/java/carpetfixes/mixins/blockUpdates/AbstractRailBlock_invalidUpdateMixin.java new file mode 100644 index 00000000..6b801634 --- /dev/null +++ b/src/main/java/carpetfixes/mixins/blockUpdates/AbstractRailBlock_invalidUpdateMixin.java @@ -0,0 +1,39 @@ +package carpetfixes.mixins.blockUpdates; + +import carpetfixes.CarpetFixesSettings; +import net.minecraft.block.AbstractRailBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.enums.RailShape; +import net.minecraft.state.property.Property; +import net.minecraft.util.math.BlockPos; +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.CallbackInfo; + +@Mixin(AbstractRailBlock.class) +public abstract class AbstractRailBlock_invalidUpdateMixin extends Block { + + public AbstractRailBlock_invalidUpdateMixin(Settings settings) { + super(settings); + } + + @Shadow public abstract Property getShapeProperty(); + + @Shadow private static boolean shouldDropRail(BlockPos pos, World world, RailShape shape) { return true;} + + @Inject(method = "onBlockAdded(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)V", at = @At("HEAD"), cancellable = true) + private void updateNeighborsExceptWithBetterDirection(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify, CallbackInfo ci) { + if (CarpetFixesSettings.railInvalidUpdateOnPushFix) { + RailShape railShape = state.get(this.getShapeProperty()); + if (shouldDropRail(pos, world, railShape)) { + dropStacks(state, world, pos); + world.removeBlock(pos, notify); + ci.cancel(); + } + } + } +} diff --git a/src/main/java/carpetfixes/mixins/coreSystemFixes/ServerPlayNetworkHandler_vehicleFloatingMixin.java b/src/main/java/carpetfixes/mixins/coreSystemFixes/ServerPlayNetworkHandler_vehicleFloatingMixin.java new file mode 100644 index 00000000..ac94ff89 --- /dev/null +++ b/src/main/java/carpetfixes/mixins/coreSystemFixes/ServerPlayNetworkHandler_vehicleFloatingMixin.java @@ -0,0 +1,24 @@ +package carpetfixes.mixins.coreSystemFixes; + +import carpetfixes.CarpetFixesSettings; +import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket; +import net.minecraft.server.network.ServerPlayNetworkHandler; +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(ServerPlayNetworkHandler.class) +public class ServerPlayNetworkHandler_vehicleFloatingMixin { + + @Shadow private boolean floating; + @Shadow private boolean ridingEntity; + + @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) { + 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 92ed9032..a297503f 100644 --- a/src/main/java/carpetfixes/mixins/coreSystemFixes/StringTag_ChunkRegenMixin.java +++ b/src/main/java/carpetfixes/mixins/coreSystemFixes/StringTag_ChunkRegenMixin.java @@ -28,7 +28,7 @@ public abstract class StringTag_ChunkRegenMixin { private void respectReadLimitDuringWrite(DataOutput output, CallbackInfo ci) { if(CarpetFixesSettings.chunkRegenFix) { int strlen = this.value.length(); - if(strlen > 21850) { //Minimum number that could bypass limit + if(strlen > 28501) { //Minimum number that could bypass limit int utflen = 0; char c; /* Mostly same equation used in DataOutputStream */ diff --git a/src/main/java/carpetfixes/mixins/coreSystemFixes/TheEndBiomeSource_endVoidMixin.java b/src/main/java/carpetfixes/mixins/coreSystemFixes/TheEndBiomeSource_endVoidMixin.java new file mode 100644 index 00000000..3ad2579d --- /dev/null +++ b/src/main/java/carpetfixes/mixins/coreSystemFixes/TheEndBiomeSource_endVoidMixin.java @@ -0,0 +1,44 @@ +package carpetfixes.mixins.coreSystemFixes; + +import carpetfixes.CarpetFixesSettings; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.noise.SimplexNoiseSampler; +import net.minecraft.world.biome.source.TheEndBiomeSource; +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(TheEndBiomeSource.class) +public class TheEndBiomeSource_endVoidMixin { + + @Inject(method= "getNoiseAt(Lnet/minecraft/util/math/noise/SimplexNoiseSampler;II)F",at=@At("HEAD"),cancellable = true) + private static void getNoiseAt(SimplexNoiseSampler simplexNoiseSampler, int x, int z, CallbackInfoReturnable cir) { + if (CarpetFixesSettings.endVoidRingsFix) { + int chunkX = x / 2; + int chunkZ = z / 2; + int chunkSectionX = x % 2; + int chunkSectionZ = z % 2; + float noiseShift = -100; + if (MathHelper.abs(x) < 400 && MathHelper.abs(z) < 400) { + noiseShift = 400 - MathHelper.sqrt(x * x + z * z) * 8; + noiseShift = MathHelper.clamp(noiseShift, -100, 80); + } + + for (int islandX = -12; islandX <= 12; ++islandX) { + for (int islandZ = -12; islandZ <= 12; ++islandZ) { + long areaX = (chunkX + islandX); + long areaZ = (chunkZ + islandZ); + if (areaX * areaX + areaZ * areaZ > 4096L && simplexNoiseSampler.sample(areaX, areaZ) < -0.8999999761581421D) { + float seedX = (chunkSectionX - islandX * 2); + float seedZ = (chunkSectionZ - islandZ * 2); + float compression = 100.0F - MathHelper.sqrt(seedX * seedX + seedZ * seedZ) * ((MathHelper.abs(areaX) * 3439.0F + MathHelper.abs(areaZ) * 147.0F) % 13.0F + 9.0F); + compression = MathHelper.clamp(compression, -100.0F, 80.0F); + noiseShift = Math.max(noiseShift, compression); + } + } + } + cir.setReturnValue(noiseShift); + } + } +} diff --git a/src/main/java/carpetfixes/mixins/coreSystemFixes/World_updateSuppressionMixin.java b/src/main/java/carpetfixes/mixins/coreSystemFixes/World_updateSuppressionMixin.java deleted file mode 100644 index bd8d56a0..00000000 --- a/src/main/java/carpetfixes/mixins/coreSystemFixes/World_updateSuppressionMixin.java +++ /dev/null @@ -1,20 +0,0 @@ -package carpetfixes.mixins.coreSystemFixes; - -import carpetfixes.CarpetFixesSettings; -import net.minecraft.block.Block; -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(World.class) -public abstract class World_updateSuppressionMixin { - @Inject(method = "updateNeighbor", at = @At(value = "HEAD", target = "Lnet/minecraft/util/crash/CrashReport;create(Ljava/lang/Throwable;Ljava/lang/String;)Lnet/minecraft/util/crash/CrashReport;"), cancellable = true) - public void updateNeighbor(BlockPos sourcePos, Block sourceBlock, BlockPos neighborPos, CallbackInfo ci) { - if (CarpetFixesSettings.updateSuppressionFix) { - ci.cancel(); - } - } -} diff --git a/src/main/java/carpetfixes/mixins/entityFixes/CatEntity$SleepWithOwnerGoal_breakLeashMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/CatEntity$SleepWithOwnerGoal_breakLeashMixin.java new file mode 100644 index 00000000..597f0d4c --- /dev/null +++ b/src/main/java/carpetfixes/mixins/entityFixes/CatEntity$SleepWithOwnerGoal_breakLeashMixin.java @@ -0,0 +1,24 @@ +package carpetfixes.mixins.entityFixes; + +import carpetfixes.CarpetFixesSettings; +import net.minecraft.entity.passive.CatEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; +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.Redirect; + +@Mixin(targets = "net.minecraft.entity.passive.CatEntity$SleepWithOwnerGoal") +public class CatEntity$SleepWithOwnerGoal_breakLeashMixin { + @Shadow @Final private CatEntity cat; + + @Redirect(method = "dropMorningGifts()V", at = @At(value="INVOKE",target="Lnet/minecraft/util/math/BlockPos$Mutable;set(Lnet/minecraft/util/math/Vec3i;)Lnet/minecraft/util/math/BlockPos$Mutable;", ordinal=0)) + public BlockPos.Mutable SetCorrectly(BlockPos.Mutable mutable, Vec3i pos) { + if (CarpetFixesSettings.catsBreakLeadsDuringGiftFix && this.cat.isLeashed()) { + pos = this.cat.getHoldingEntity().getBlockPos(); + } + return mutable.set(pos); + } +} diff --git a/src/main/java/carpetfixes/mixins/entityFixes/EndermanEntity$PlaceBlockGoal_updatePlaceMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/EndermanEntity$PlaceBlockGoal_updatePlaceMixin.java new file mode 100644 index 00000000..a217f991 --- /dev/null +++ b/src/main/java/carpetfixes/mixins/entityFixes/EndermanEntity$PlaceBlockGoal_updatePlaceMixin.java @@ -0,0 +1,30 @@ +package carpetfixes.mixins.entityFixes; + +import carpetfixes.CarpetFixesSettings; +import net.minecraft.block.BlockState; +import net.minecraft.entity.mob.EndermanEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +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.Redirect; + +@Mixin(targets="net/minecraft/entity/mob/EndermanEntity$PlaceBlockGoal") +public class EndermanEntity$PlaceBlockGoal_updatePlaceMixin { + + @Shadow @Final private EndermanEntity enderman; + + @Redirect(method= "tick()V",at=@At(value="INVOKE",target="Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z")) + public boolean placeCorrectly(World world, BlockPos pos, BlockState state, int flags){ + if (CarpetFixesSettings.endermanDontUpdateOnPlaceFix) { + if (world.setBlockState(pos, state, 3)) { + state.getBlock().onPlaced(world, pos, state, this.enderman, state.getBlock().asItem().getDefaultStack()); + return true; + } + return false; + } + return world.setBlockState(pos, state, 3); + } +} diff --git a/src/main/java/carpetfixes/mixins/entityFixes/Entity_blockCollisionMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/Entity_blockCollisionMixin.java index 7cd4dcaa..cd5692f7 100644 --- a/src/main/java/carpetfixes/mixins/entityFixes/Entity_blockCollisionMixin.java +++ b/src/main/java/carpetfixes/mixins/entityFixes/Entity_blockCollisionMixin.java @@ -54,7 +54,7 @@ public boolean shouldCheckCollision(Block block) { ) public void checkBlockCollisionBetter(BlockState blockState, World world, BlockPos pos, Entity entity) { boolean pass = shouldCheckCollision(blockState.getBlock()); - if (entity instanceof PlayerEntity && (!CarpetFixesSettings.blockCollisionCheckFix || (first && pass) || (!first && !pass))) { + if (!CarpetFixesSettings.blockCollisionCheckFix || !(entity instanceof PlayerEntity) || (first && pass) || (!first && !pass)) { blockState.onEntityCollision(world, pos, entity); } } diff --git a/src/main/java/carpetfixes/mixins/entityFixes/Entity_directionalBlockSlowdownMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/Entity_directionalBlockSlowdownMixin.java new file mode 100644 index 00000000..fd3ccdb0 --- /dev/null +++ b/src/main/java/carpetfixes/mixins/entityFixes/Entity_directionalBlockSlowdownMixin.java @@ -0,0 +1,30 @@ +package carpetfixes.mixins.entityFixes; + +import carpetfixes.CarpetFixesSettings; +import net.minecraft.block.BlockState; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.Vec3d; +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(Entity.class) +public class Entity_directionalBlockSlowdownMixin { + @Shadow public float fallDistance; + @Shadow protected Vec3d movementMultiplier; + + @Inject(method = "slowMovement(Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/Vec3d;)V", at = @At("HEAD"), cancellable = true) + 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 + ); + ci.cancel(); + } + } +} diff --git a/src/main/java/carpetfixes/mixins/entityFixes/Entity_incorrectLogicMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/Entity_incorrectLogicMixin.java new file mode 100644 index 00000000..6f5de2ee --- /dev/null +++ b/src/main/java/carpetfixes/mixins/entityFixes/Entity_incorrectLogicMixin.java @@ -0,0 +1,29 @@ +package carpetfixes.mixins.entityFixes; + +import carpetfixes.CarpetFixesSettings; +import net.minecraft.entity.Entity; +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(Entity.class) +public abstract class Entity_incorrectLogicMixin { + + @Shadow public abstract void setOnGround(boolean onGround); + + @Inject(method = "onBubbleColumnCollision(Z)V", at = @At("HEAD"), cancellable = true) + public void onBubbleColumnCollision(boolean drag, CallbackInfo ci) { + if (CarpetFixesSettings.incorrectBubbleColumnLogicFix) { + this.setOnGround(false); + } + } + + @Inject(method = "onBubbleColumnSurfaceCollision(Z)V", at = @At("HEAD"), cancellable = true) + public void onBubbleColumnSurfaceCollision(boolean drag, CallbackInfo ci) { + if (CarpetFixesSettings.incorrectBubbleColumnLogicFix) { + this.setOnGround(false); + } + } +} diff --git a/src/main/resources/carpetfixes.accesswidener b/src/main/resources/carpetfixes.accesswidener index 22e331b7..0b8698b2 100644 --- a/src/main/resources/carpetfixes.accesswidener +++ b/src/main/resources/carpetfixes.accesswidener @@ -1 +1 @@ -accessWidener v1 named \ No newline at end of file +accessWidener v1 named diff --git a/src/main/resources/carpetfixes.mixins.json b/src/main/resources/carpetfixes.mixins.json index 5762a401..5a0a3ecc 100644 --- a/src/main/resources/carpetfixes.mixins.json +++ b/src/main/resources/carpetfixes.mixins.json @@ -5,26 +5,34 @@ "mixins": [ "backports.AbstractFireBlock_flintAndSteelMixin", "backports.PlayerManager_LlamaRidingDupeMixin", + "blockFixes.SlimeBlock_incorrectLogicMixin", + "blockUpdates.AbstractRailBlock_invalidUpdateMixin", "blockUpdates.SpongeBlock_MissingUpdateMixin", "blockUpdates.World_blockUpdateOrderMixin", "coreSystemFixes.Biome_featureOrderMixin", "coreSystemFixes.Feature_featureOrderMixin", + "coreSystemFixes.ServerPlayNetworkHandler_vehicleFloatingMixin", "coreSystemFixes.StringTag_ChunkRegenMixin", - "coreSystemFixes.World_updateSuppressionMixin", + "coreSystemFixes.TheEndBiomeSource_endVoidMixin", "drownedMemoryLeak.DrownedEntity_drownedMemoryLeakAccessor", "drownedMemoryLeak.DrownedEntity_drownedMemoryLeakMixin", "drownedMemoryLeak.ServerWorld_drownedMemoryLeakMixin", "dupeFixes.AbstractRailBlock_duplicationMixin", "dupeFixes.FallingBlockEntity_duplicationMixin", "dupeFixes.PistonBlock_tntDupingFixMixin", + "entityFixes.CatEntity$SleepWithOwnerGoal_breakLeashMixin", "entityFixes.EndCrystalEntity_ExplosionChainingMixin", + "entityFixes.EndermanEntity$PlaceBlockGoal_updatePlaceMixin", "entityFixes.Entity_blockCollisionMixin", + "entityFixes.Entity_directionalBlockSlowdownMixin", + "entityFixes.Entity_incorrectLogicMixin", "entityFixes.EntityAccessorMixin", "entityFixes.ItemEntity_shulkerDroppingMixin", "entityFixes.LivingEntity_VisibilityCheckMixin", "entityFixes.ShulkerEntity_CustomDataMixin", "redstoneFixes.AbstractRedstoneGateBlock_repeaterPriorityMixin", "redstoneFixes.PistonBlock_doubleRetractionMixin", + "redstoneFixes.TargetBlock_PermanentlyPoweredMixin", "redstoneFixes.World_ComparatorNotUpdatingMixin" ], "injectors": {