diff --git a/gradle.properties b/gradle.properties index 1530ae59..aead35ed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,13 +3,13 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties # check these on https://fabricmc.net/use or https://modmuss50.me/fabric.html -minecraft_version=1.20 +minecraft_version=1.20.4 display_minecraft_version=1.20 -yarn_mappings=1.20+build.1 -loader_version=0.14.3 -carpet_minecraft_version=1.20 +yarn_mappings=1.20.4+build.3 +loader_version=0.15.3 +carpet_minecraft_version=1.20.3 # check available versions on maven for the given minecraft version you are using -carpet_core_version=1.4.112+v230608 +carpet_core_version=1.4.128+v231205 # Mod Properties diff --git a/src/main/java/carpetfixes/mixins/advanced/MinecraftServer_autosaveDelayMixin.java b/src/main/java/carpetfixes/mixins/advanced/MinecraftServer_autosaveDelayMixin.java index 61e80d82..db828c1a 100644 --- a/src/main/java/carpetfixes/mixins/advanced/MinecraftServer_autosaveDelayMixin.java +++ b/src/main/java/carpetfixes/mixins/advanced/MinecraftServer_autosaveDelayMixin.java @@ -10,29 +10,30 @@ public class MinecraftServer_autosaveDelayMixin { - @ModifyConstant( - method = "tick(Ljava/util/function/BooleanSupplier;)V", - constant = @Constant(intValue = 6000) - ) - public int tickAutoSave(int autoSaveDelay) { - return CFSettings.delayBetweenAutoSaves; - } - - - @ModifyConstant( - method = "canExecute(Lnet/minecraft/server/ServerTask;)Z", - constant = @Constant(intValue = 3) //statusUpdateDelay - ) - public int shouldRunWithLatency(int maxTickLatency) { - return CFSettings.maxTickLatency; - } - - - @ModifyConstant( - method = "tick(Ljava/util/function/BooleanSupplier;)V", - constant = @Constant(longValue = 5000000000L) - ) - public long customStatusUpdateDelay(long maxTickLatency) { - return CFSettings.statusUpdateDelay; - } +// FIXME - this seems to have been rewritten +// @ModifyConstant( +// method = "tick(Ljava/util/function/BooleanSupplier;)V", +// constant = @Constant(intValue = 6000) +// ) +// public int tickAutoSave(int autoSaveDelay) { +// return CFSettings.delayBetweenAutoSaves; +// } +// +// +// @ModifyConstant( +// method = "canExecute(Lnet/minecraft/server/ServerTask;)Z", +// constant = @Constant(intValue = 3) //statusUpdateDelay +// ) +// public int shouldRunWithLatency(int maxTickLatency) { +// return CFSettings.maxTickLatency; +// } +// +// +// @ModifyConstant( +// method = "tick(Ljava/util/function/BooleanSupplier;)V", +// constant = @Constant(longValue = 5000000000L) +// ) +// public long customStatusUpdateDelay(long maxTickLatency) { +// return CFSettings.statusUpdateDelay; +// } } diff --git a/src/main/java/carpetfixes/mixins/blockFixes/EnchantingTableBlock_transparentMixin.java b/src/main/java/carpetfixes/mixins/blockFixes/EnchantingTableBlock_transparentMixin.java index 5a4a7b77..7ea464e3 100644 --- a/src/main/java/carpetfixes/mixins/blockFixes/EnchantingTableBlock_transparentMixin.java +++ b/src/main/java/carpetfixes/mixins/blockFixes/EnchantingTableBlock_transparentMixin.java @@ -16,7 +16,7 @@ public class EnchantingTableBlock_transparentMixin { @Redirect( - method = "canAccessBookshelf(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;" + + method = "canAccessPowerProvider(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;" + "Lnet/minecraft/util/math/BlockPos;)Z", at = @At( value = "INVOKE", diff --git a/src/main/java/carpetfixes/mixins/blockUpdates/HopperBlock_missingUpdateMixin.java b/src/main/java/carpetfixes/mixins/blockUpdates/HopperBlock_missingUpdateMixin.java index 39b4afca..731ef213 100644 --- a/src/main/java/carpetfixes/mixins/blockUpdates/HopperBlock_missingUpdateMixin.java +++ b/src/main/java/carpetfixes/mixins/blockUpdates/HopperBlock_missingUpdateMixin.java @@ -26,7 +26,7 @@ public HopperBlock_missingUpdateMixin(Settings settings) { @ModifyArg( method = "updateEnabled(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;" + - "Lnet/minecraft/block/BlockState;I)V", + "Lnet/minecraft/block/BlockState;)V", at = @At( value = "INVOKE", target = "Lnet/minecraft/world/World;" + diff --git a/src/main/java/carpetfixes/mixins/blockUpdates/TrapdoorBlock_missingUpdateMixin.java b/src/main/java/carpetfixes/mixins/blockUpdates/TrapdoorBlock_missingUpdateMixin.java index 1e3dc871..f0f0b4c6 100644 --- a/src/main/java/carpetfixes/mixins/blockUpdates/TrapdoorBlock_missingUpdateMixin.java +++ b/src/main/java/carpetfixes/mixins/blockUpdates/TrapdoorBlock_missingUpdateMixin.java @@ -50,7 +50,7 @@ private Direction directionToUpdate(BlockState state) { @Inject( - method = "onUse", + method = "flip", at = @At( shift = At.Shift.AFTER, value = "INVOKE", @@ -59,7 +59,7 @@ private Direction directionToUpdate(BlockState state) { ) ) private void updateOnUseCorrectly(BlockState state, World world, BlockPos pos, PlayerEntity player, - Hand hand, BlockHitResult hit, CallbackInfoReturnable cir) { + CallbackInfo ci) { if (CFSettings.trapdoorMissingUpdateFix) world.updateNeighbor(pos.offset(directionToUpdate(state)),state.getBlock(),pos); } diff --git a/src/main/java/carpetfixes/mixins/blockUpdates/duplicateUpdates/RedstoneTorchBlock_updateMixin.java b/src/main/java/carpetfixes/mixins/blockUpdates/duplicateUpdates/RedstoneTorchBlock_updateMixin.java index 460d0dd3..08a63563 100644 --- a/src/main/java/carpetfixes/mixins/blockUpdates/duplicateUpdates/RedstoneTorchBlock_updateMixin.java +++ b/src/main/java/carpetfixes/mixins/blockUpdates/duplicateUpdates/RedstoneTorchBlock_updateMixin.java @@ -4,7 +4,7 @@ import carpetfixes.helpers.BlockUpdateUtils; import net.minecraft.block.BlockState; import net.minecraft.block.RedstoneTorchBlock; -import net.minecraft.block.TorchBlock; +import net.minecraft.block.AbstractTorchBlock; import net.minecraft.particle.ParticleEffect; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -18,12 +18,12 @@ */ @Mixin(RedstoneTorchBlock.class) -public abstract class RedstoneTorchBlock_updateMixin extends TorchBlock { +public abstract class RedstoneTorchBlock_updateMixin extends AbstractTorchBlock { RedstoneTorchBlock self = (RedstoneTorchBlock)(Object)this; - protected RedstoneTorchBlock_updateMixin(Settings settings, ParticleEffect particle) { - super(settings, particle); + protected RedstoneTorchBlock_updateMixin(Settings settings) { + super(settings); } diff --git a/src/main/java/carpetfixes/mixins/coreSystemFixes/StatusEffectInstance_wrongEffectMixin.java b/src/main/java/carpetfixes/mixins/coreSystemFixes/StatusEffectInstance_wrongEffectMixin.java index 82d181c0..176a04c6 100644 --- a/src/main/java/carpetfixes/mixins/coreSystemFixes/StatusEffectInstance_wrongEffectMixin.java +++ b/src/main/java/carpetfixes/mixins/coreSystemFixes/StatusEffectInstance_wrongEffectMixin.java @@ -49,7 +49,7 @@ public abstract class StatusEffectInstance_wrongEffectMixin { private void addHere(LivingEntity entity, Runnable overwriteCallback, CallbackInfoReturnable cir) { if (CFSettings.brokenHiddenStatusEffectFix) { ((LivingEntityAccessor)entity).setEffectsChanged(true); - this.getEffectType().onRemoved(entity, entity.getAttributes(), this.getAmplifier()); + this.getEffectType().onRemoved(entity.getAttributes()); } } @@ -63,7 +63,7 @@ private void addHere(LivingEntity entity, Runnable overwriteCallback, CallbackIn ) private void removeHere(LivingEntity entity, Runnable overwriteCallback, CallbackInfoReturnable cir) { if (CFSettings.brokenHiddenStatusEffectFix) { - this.getEffectType().onApplied(entity, entity.getAttributes(), this.getAmplifier()); + this.getEffectType().onApplied(entity.getAttributes(), this.getAmplifier()); } } diff --git a/src/main/java/carpetfixes/mixins/dupeFixes/TripwireHookBlock_hookDupeMixin.java b/src/main/java/carpetfixes/mixins/dupeFixes/TripwireHookBlock_hookDupeMixin.java index c00089ce..248084f1 100644 --- a/src/main/java/carpetfixes/mixins/dupeFixes/TripwireHookBlock_hookDupeMixin.java +++ b/src/main/java/carpetfixes/mixins/dupeFixes/TripwireHookBlock_hookDupeMixin.java @@ -26,10 +26,10 @@ public TripwireHookBlock_hookDupeMixin(Settings settings) { } @Shadow - protected abstract void playSound(World w, BlockPos pos, boolean a, boolean on, boolean detached, boolean off); + protected static void playSound(World w, BlockPos pos, boolean a, boolean on, boolean detached, boolean off) { } @Shadow - protected abstract void updateNeighborsOnAxis(World world, BlockPos pos, Direction direction); + protected static void updateNeighborsOnAxis(Block block, World world, BlockPos pos, Direction direction) { } /** @@ -37,11 +37,12 @@ public TripwireHookBlock_hookDupeMixin(Settings settings) { * @reason Fix for the tripwire hook duplication bug */ @Overwrite - public void update(World world, BlockPos pos, BlockState state, boolean beingRemoved, + public static void update(World world, BlockPos pos, BlockState state, boolean beingRemoved, boolean bl, int i, @Nullable BlockState blockState) { Direction direction = state.get(FACING); boolean attached = state.get(ATTACHED); boolean powered = state.get(POWERED); + Block block = state.getBlock(); boolean notRemoving = !beingRemoved; boolean on = false; int index = 0; @@ -63,32 +64,32 @@ public void update(World world, BlockPos pos, BlockState state, boolean beingRem on |= armed && blockState2.get(TripwireBlock.POWERED); blockStates[k] = blockState2; if (k == i) { - world.scheduleBlockTick(pos, this, 10); + world.scheduleBlockTick(pos, block, 10); notRemoving &= armed; } } } notRemoving &= index > 1; on &= notRemoving; - BlockState newState = this.getDefaultState().with(ATTACHED, notRemoving).with(POWERED, on); + BlockState newState = block.getDefaultState().with(ATTACHED, notRemoving).with(POWERED, on); if (index > 0) { blockPos = pos.offset(direction, index); Direction blockState2 = direction.getOpposite(); world.setBlockState(blockPos, newState.with(FACING, blockState2), Block.NOTIFY_ALL); - this.updateNeighborsOnAxis(world, blockPos, blockState2); - this.playSound(world, blockPos, notRemoving, on, attached, powered); + updateNeighborsOnAxis(block, world, blockPos, blockState2); + playSound(world, blockPos, notRemoving, on, attached, powered); } - this.playSound(world, pos, notRemoving, on, attached, powered); - if (!beingRemoved && (!CFSettings.tripwireHookDupeFix || world.getBlockState(pos).isOf(this))) { + playSound(world, pos, notRemoving, on, attached, powered); + if (!beingRemoved && (!CFSettings.tripwireHookDupeFix || world.getBlockState(pos).isOf(Blocks.TRIPWIRE_HOOK))) { world.setBlockState(pos, newState.with(FACING, direction), Block.NOTIFY_ALL); - if (bl) this.updateNeighborsOnAxis(world, pos, direction); + if (bl) updateNeighborsOnAxis(block, world, pos, direction); } if (attached != notRemoving) { for(int x = 1; x < index; ++x) { BlockPos pos2 = pos.offset(direction, x); BlockState state2 = blockStates[x]; if (state2 != null) { - if (!CFSettings.tripwireNotDisarmingFix || world.getBlockState(pos2).isOf(this)) { + if (!CFSettings.tripwireNotDisarmingFix || world.getBlockState(pos2).isOf(Blocks.TRIPWIRE_HOOK)) { world.setBlockState(pos2, state2.with(ATTACHED, notRemoving), Block.NOTIFY_ALL); } } diff --git a/src/main/java/carpetfixes/mixins/dupeFixes/saferItemTransfer/DropperBlock_dontCopyMixin.java b/src/main/java/carpetfixes/mixins/dupeFixes/saferItemTransfer/DropperBlock_dontCopyMixin.java index 00df7ea9..b415cd86 100644 --- a/src/main/java/carpetfixes/mixins/dupeFixes/saferItemTransfer/DropperBlock_dontCopyMixin.java +++ b/src/main/java/carpetfixes/mixins/dupeFixes/saferItemTransfer/DropperBlock_dontCopyMixin.java @@ -1,6 +1,7 @@ package carpetfixes.mixins.dupeFixes.saferItemTransfer; import carpetfixes.CFSettings; +import net.minecraft.block.BlockState; import net.minecraft.block.DropperBlock; import net.minecraft.item.ItemStack; import net.minecraft.server.world.ServerWorld; @@ -24,7 +25,7 @@ public class DropperBlock_dontCopyMixin { @Redirect( - method = "dispense(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;)V", + method = "dispense(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)V", slice = @Slice( from = @At("HEAD"), to = @At( @@ -46,7 +47,7 @@ protected ItemStack shouldCopyFirst(ItemStack itemStack) { @Redirect( - method = "dispense(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;)V", + method = "dispense(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)V", slice = @Slice( from = @At( value = "INVOKE", @@ -65,10 +66,10 @@ protected ItemStack shouldCopy(ItemStack itemStack) { @Inject( - method = "dispense(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/math/BlockPos;)V", + method = "dispense(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;)V", at = @At("TAIL") ) - private void removeInstance(ServerWorld world, BlockPos pos, CallbackInfo ci) { + private void removeInstance(ServerWorld world, BlockState state, BlockPos pos, CallbackInfo ci) { stack = ItemStack.EMPTY; } } diff --git a/src/main/java/carpetfixes/mixins/entityFixes/ArmorStandEntity_damageMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/ArmorStandEntity_damageMixin.java index d8ce24a5..64143016 100644 --- a/src/main/java/carpetfixes/mixins/entityFixes/ArmorStandEntity_damageMixin.java +++ b/src/main/java/carpetfixes/mixins/entityFixes/ArmorStandEntity_damageMixin.java @@ -22,7 +22,7 @@ public abstract class ArmorStandEntity_damageMixin { method = "damage(Lnet/minecraft/entity/damage/DamageSource;F)Z", at = @At( value = "INVOKE", - target = "Lnet/minecraft/entity/damage/DamageSource;getSource()Lnet/minecraft/entity/Entity;", + target = "Lnet/minecraft/entity/damage/DamageSource;getAttacker()Lnet/minecraft/entity/Entity;", ordinal = 0, shift = At.Shift.BEFORE ), diff --git a/src/main/java/carpetfixes/mixins/entityFixes/DrownedEntity_enchantedTridentMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/DrownedEntity_enchantedTridentMixin.java index aa89420c..1bdd41f2 100644 --- a/src/main/java/carpetfixes/mixins/entityFixes/DrownedEntity_enchantedTridentMixin.java +++ b/src/main/java/carpetfixes/mixins/entityFixes/DrownedEntity_enchantedTridentMixin.java @@ -32,7 +32,7 @@ public DrownedEntity_enchantedTridentMixin(EntityType en @Redirect( - method = "attack", + method = "shootAt", at = @At( value = "NEW", target = "net/minecraft/item/ItemStack" diff --git a/src/main/java/carpetfixes/mixins/entityFixes/TridentEntity_fallingMixin.java b/src/main/java/carpetfixes/mixins/entityFixes/TridentEntity_fallingMixin.java index 66013441..f048d35f 100644 --- a/src/main/java/carpetfixes/mixins/entityFixes/TridentEntity_fallingMixin.java +++ b/src/main/java/carpetfixes/mixins/entityFixes/TridentEntity_fallingMixin.java @@ -4,6 +4,7 @@ import net.minecraft.entity.EntityType; import net.minecraft.entity.projectile.PersistentProjectileEntity; import net.minecraft.entity.projectile.TridentEntity; +import net.minecraft.item.ItemStack; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -17,8 +18,8 @@ @Mixin(TridentEntity.class) public abstract class TridentEntity_fallingMixin extends PersistentProjectileEntity { - protected TridentEntity_fallingMixin(EntityType entityType, World world) { - super(entityType, world); + protected TridentEntity_fallingMixin(EntityType entityType, World world, ItemStack stack) { + super(entityType, world, stack); } @Shadow diff --git a/src/main/java/carpetfixes/mixins/playerFixes/PlayerAdvancementTracker_grantCriterionMixin.java b/src/main/java/carpetfixes/mixins/playerFixes/PlayerAdvancementTracker_grantCriterionMixin.java index 23d0d583..0bf87cc8 100644 --- a/src/main/java/carpetfixes/mixins/playerFixes/PlayerAdvancementTracker_grantCriterionMixin.java +++ b/src/main/java/carpetfixes/mixins/playerFixes/PlayerAdvancementTracker_grantCriterionMixin.java @@ -2,6 +2,7 @@ import carpetfixes.CFSettings; import net.minecraft.advancement.Advancement; +import net.minecraft.advancement.AdvancementEntry; import net.minecraft.advancement.PlayerAdvancementTracker; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.world.GameMode; @@ -27,7 +28,7 @@ public class PlayerAdvancementTracker_grantCriterionMixin { at = @At("HEAD"), cancellable = true ) - private void grantCriterion(Advancement advancement, String criterionName, CallbackInfoReturnable cir) { + private void grantCriterion(AdvancementEntry advancement, String criterionName, CallbackInfoReturnable cir) { if (CFSettings.spectatorAdvancementGrantingFix && owner.interactionManager.getGameMode().equals(GameMode.SPECTATOR)) { cir.cancel(); diff --git a/src/main/java/carpetfixes/mixins/playerFixes/PlayerEntity_absorptionMixin.java b/src/main/java/carpetfixes/mixins/playerFixes/PlayerEntity_absorptionMixin.java index 6c9359eb..bf71201c 100644 --- a/src/main/java/carpetfixes/mixins/playerFixes/PlayerEntity_absorptionMixin.java +++ b/src/main/java/carpetfixes/mixins/playerFixes/PlayerEntity_absorptionMixin.java @@ -28,7 +28,7 @@ protected PlayerEntity_absorptionMixin(EntityType entity @Inject( - method = "setAbsorptionAmount(F)V", + method = "setAbsorptionAmountUnclamped(F)V", at = @At("RETURN") ) private void onAbsorptionChanged(float amount, CallbackInfo ci) { diff --git a/src/main/java/carpetfixes/mixins/redstoneFixes/AbstractRedstoneGateBlock_repeaterPriorityMixin.java b/src/main/java/carpetfixes/mixins/redstoneFixes/AbstractRedstoneGateBlock_repeaterPriorityMixin.java index a94d5dca..3bdd7c9d 100644 --- a/src/main/java/carpetfixes/mixins/redstoneFixes/AbstractRedstoneGateBlock_repeaterPriorityMixin.java +++ b/src/main/java/carpetfixes/mixins/redstoneFixes/AbstractRedstoneGateBlock_repeaterPriorityMixin.java @@ -15,7 +15,7 @@ */ @Mixin(AbstractRedstoneGateBlock.class) -public class AbstractRedstoneGateBlock_repeaterPriorityMixin extends HorizontalFacingBlock { +abstract public class AbstractRedstoneGateBlock_repeaterPriorityMixin extends HorizontalFacingBlock { protected AbstractRedstoneGateBlock_repeaterPriorityMixin(Settings settings) { super(settings); diff --git a/src/main/java/carpetfixes/mixins/utils/Entity_dimensionsMixin.java b/src/main/java/carpetfixes/mixins/utils/Entity_dimensionsMixin.java index 6aa9023b..6531423a 100644 --- a/src/main/java/carpetfixes/mixins/utils/Entity_dimensionsMixin.java +++ b/src/main/java/carpetfixes/mixins/utils/Entity_dimensionsMixin.java @@ -192,7 +192,7 @@ private static Vec3d adjustMovementForCollisionsAtPos(@Nullable Entity entity, V } private static boolean canWorldBorderCollideAtPos(WorldBorder worldBorder, Vec3d pos, Box box) { - double d = Math.max(MathHelper.absMax(box.getXLength(), box.getZLength()), 1.0); + double d = Math.max(MathHelper.absMax(box.getLengthX(), box.getLengthZ()), 1.0); return worldBorder.getDistanceInsideBorder(pos.getX(), pos.getZ()) < d * 2.0 && worldBorder.contains(pos.getX(), pos.getZ(), d); } diff --git a/src/main/resources/carpet-fixes.accesswidener b/src/main/resources/carpet-fixes.accesswidener index 30a222bc..bf799835 100644 --- a/src/main/resources/carpet-fixes.accesswidener +++ b/src/main/resources/carpet-fixes.accesswidener @@ -17,3 +17,4 @@ accessible class net/minecraft/world/chunk/PaletteResizeListener accessible method net/minecraft/world/chunk/ArrayPalette (Lnet/minecraft/util/collection/IndexedIterable;[Ljava/lang/Object;Lnet/minecraft/world/chunk/PaletteResizeListener;II)V accessible method net/minecraft/world/chunk/BiMapPalette (Lnet/minecraft/util/collection/IndexedIterable;ILnet/minecraft/world/chunk/PaletteResizeListener;Lnet/minecraft/util/collection/Int2ObjectBiMap;)V accessible field net/minecraft/block/AbstractPressurePlateBlock blockSetType Lnet/minecraft/block/BlockSetType; +extendable method net/minecraft/entity/LivingEntity canBreatheInWater ()Z