From 94fafe972c956b8d37ae4f76589081326a90d87b Mon Sep 17 00:00:00 2001 From: Ap_Tx <3045929398@qq.com> Date: Sat, 17 Oct 2026 14:41:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=82=E9=85=8D=2026.4=20=E5=BF=AB?= =?UTF-8?q?=E7=85=A7=E7=9A=84=20API=20=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 升级 Gradle wrapper 到 9.8.1(Loom 1.19.1 要求 Gradle >= 9.8.0) - accesswidener:EnderMan$EndermanTakeBlockGoal -> Enderman$EndermanTakeBlockGoal(大小写变更) - MixinRedstoneWireBlock:RedStoneWireBlock -> RedstoneWireBlock(类名大小写变更) - MixinSpawnHelper:EntityType.BAT -> EntityTypes.BAT(实体常量迁移到 EntityTypes) - BotCommand:CommonListenerCookie 构造器新增 ClientDebugInfo 参数 - MixinEnderDragonFight:EndPodiumFeature.getLocation(BlockPos) 移除,改用 EnderDragonFight.getPodiumLocation(BlockPos) 并 Shadow origin 字段 - ShulkerBoxItemUtil:ItemContainerContents.allItemsCopyStream() -> nonEmptyItemCopyStream() --- gradle/wrapper/gradle-wrapper.properties | 2 +- .../carpetslsaddition/command/BotCommand.java | 3 ++- .../mixin/block/MixinRedstoneWireBlock.java | 4 ++-- .../mixin/entity/MixinEnderDragonFight.java | 11 +++++++---- .../mixin/world/MixinSpawnHelper.java | 3 ++- .../carpetslsaddition/util/ShulkerBoxItemUtil.java | 2 +- src/main/resources/slsa.accesswidener | 13 +++++++------ 7 files changed, 22 insertions(+), 16 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 288cba1..4249bf0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.1-bin.zip networkTimeout=10000 retries=0 retryBackOffMs=500 diff --git a/src/main/java/com/github/zly2006/carpetslsaddition/command/BotCommand.java b/src/main/java/com/github/zly2006/carpetslsaddition/command/BotCommand.java index c59c818..a079ec9 100644 --- a/src/main/java/com/github/zly2006/carpetslsaddition/command/BotCommand.java +++ b/src/main/java/com/github/zly2006/carpetslsaddition/command/BotCommand.java @@ -41,6 +41,7 @@ import net.minecraft.server.level.ClientInformation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.CommonListenerCookie; +import net.minecraft.server.network.ClientDebugInfo; import net.minecraft.server.players.NameAndId; import net.minecraft.server.players.PlayerList; import net.minecraft.world.entity.ai.attributes.Attributes; @@ -386,7 +387,7 @@ public class BotCommand { EntityPlayerMPFake bot = constructor.newInstance(server, worldIn, gameprofile, ClientInformation.createDefault(), false); bot.fixStartingPosition = () -> bot.snapTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch); - server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), bot, new CommonListenerCookie(gameprofile, 0, bot.clientInformation(), false)); + server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), bot, new CommonListenerCookie(gameprofile, 0, bot.clientInformation(), false, new ClientDebugInfo())); bot.teleportTo(worldIn, pos.x, pos.y, pos.z, Set.of(), (float) yaw, (float) pitch, true); bot.setHealth(20.0F); diff --git a/src/main/java/com/github/zly2006/carpetslsaddition/mixin/block/MixinRedstoneWireBlock.java b/src/main/java/com/github/zly2006/carpetslsaddition/mixin/block/MixinRedstoneWireBlock.java index 8124fd6..8a875ee 100644 --- a/src/main/java/com/github/zly2006/carpetslsaddition/mixin/block/MixinRedstoneWireBlock.java +++ b/src/main/java/com/github/zly2006/carpetslsaddition/mixin/block/MixinRedstoneWireBlock.java @@ -3,13 +3,13 @@ package com.github.zly2006.carpetslsaddition.mixin.block; import com.github.zly2006.carpetslsaddition.SLSCarpetSettings; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.RedStoneWireBlock; +import net.minecraft.world.level.block.RedstoneWireBlock; import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; -@Mixin(value = RedStoneWireBlock.class, priority = 1) +@Mixin(value = RedstoneWireBlock.class, priority = 1) public class MixinRedstoneWireBlock { // oldRedstoneConnectionLogic:让红石能连到活板门上的红石线。 // 新版在 getConnectingSide 里用 `blockState.getBlock() instanceof TrapDoorBlock` 判断。 diff --git a/src/main/java/com/github/zly2006/carpetslsaddition/mixin/entity/MixinEnderDragonFight.java b/src/main/java/com/github/zly2006/carpetslsaddition/mixin/entity/MixinEnderDragonFight.java index 1773a59..edf2635 100644 --- a/src/main/java/com/github/zly2006/carpetslsaddition/mixin/entity/MixinEnderDragonFight.java +++ b/src/main/java/com/github/zly2006/carpetslsaddition/mixin/entity/MixinEnderDragonFight.java @@ -15,7 +15,7 @@ import net.minecraft.world.level.block.state.pattern.BlockInWorld; import net.minecraft.world.level.block.state.pattern.BlockPattern; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraft.world.level.levelgen.feature.EndPodiumFeature; +import net.minecraft.world.level.dimension.end.EnderDragonFight; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; @@ -37,6 +37,9 @@ public class MixinEnderDragonFight { @Shadow private BlockPos exitPortalLocation; + @Shadow + private BlockPos origin; + @Unique private int defaultChunkX = -8; @Unique @@ -79,13 +82,13 @@ public class MixinEnderDragonFight { if (SLSCarpetSettings.optimizedOnDragonRespawn && defaultOriginY != -1) { i = defaultOriginY; } else { - i = this.level.getHeight(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(BlockPos.ZERO).getX(), EndPodiumFeature.getLocation(BlockPos.ZERO).getZ()); + i = this.level.getHeight(Heightmap.Types.MOTION_BLOCKING, EnderDragonFight.getPodiumLocation(this.origin).getX(), EnderDragonFight.getPodiumLocation(this.origin).getZ()); } boolean notFirstSearch = false; for (j = i; j >= 0; --j) { BlockPattern.BlockPatternMatch result2; - BlockPos origin = EndPodiumFeature.getLocation(BlockPos.ZERO); - BlockPos searchPos = new BlockPos(origin.getX(), j, origin.getZ()); + BlockPos podiumPos = EnderDragonFight.getPodiumLocation(this.origin); + BlockPos searchPos = new BlockPos(podiumPos.getX(), j, podiumPos.getZ()); if (SLSCarpetSettings.optimizedOnDragonRespawn && notFirstSearch) { result2 = partialSearchAround(this.exitPortalPattern, this.level, searchPos); } else { diff --git a/src/main/java/com/github/zly2006/carpetslsaddition/mixin/world/MixinSpawnHelper.java b/src/main/java/com/github/zly2006/carpetslsaddition/mixin/world/MixinSpawnHelper.java index c2df27d..9332a41 100644 --- a/src/main/java/com/github/zly2006/carpetslsaddition/mixin/world/MixinSpawnHelper.java +++ b/src/main/java/com/github/zly2006/carpetslsaddition/mixin/world/MixinSpawnHelper.java @@ -3,6 +3,7 @@ package com.github.zly2006.carpetslsaddition.mixin.world; import com.github.zly2006.carpetslsaddition.SLSCarpetSettings; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.Mob; import net.minecraft.world.level.NaturalSpawner; import org.spongepowered.asm.mixin.Mixin; @@ -16,7 +17,7 @@ public class MixinSpawnHelper { // 改为在 getMobForSpawn 返回处拦截。 @Inject(method = "getMobForSpawn", at = @At("HEAD"), cancellable = true) private static void onCreateMob(ServerLevel level, EntityType type, CallbackInfoReturnable cir) { - if (SLSCarpetSettings.noBatSpawning && type == EntityType.BAT) { + if (SLSCarpetSettings.noBatSpawning && type == EntityTypes.BAT) { cir.setReturnValue(null); } } diff --git a/src/main/java/com/github/zly2006/carpetslsaddition/util/ShulkerBoxItemUtil.java b/src/main/java/com/github/zly2006/carpetslsaddition/util/ShulkerBoxItemUtil.java index 25b54b6..f973f84 100644 --- a/src/main/java/com/github/zly2006/carpetslsaddition/util/ShulkerBoxItemUtil.java +++ b/src/main/java/com/github/zly2006/carpetslsaddition/util/ShulkerBoxItemUtil.java @@ -23,7 +23,7 @@ public class ShulkerBoxItemUtil { if (itemStack.getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof ShulkerBoxBlock) { return itemStack.getOrDefault(DataComponents.CONTAINER, ItemContainerContents.EMPTY) - .allItemsCopyStream().findAny().isEmpty(); + .nonEmptyItemCopyStream().findAny().isEmpty(); } return false; } diff --git a/src/main/resources/slsa.accesswidener b/src/main/resources/slsa.accesswidener index 348f032..2a7da24 100644 --- a/src/main/resources/slsa.accesswidener +++ b/src/main/resources/slsa.accesswidener @@ -1,7 +1,8 @@ -accessWidener v1 official - -accessible class net/minecraft/world/entity/monster/EnderMan$EndermanTakeBlockGoal -accessible method net/minecraft/world/entity/Entity unsetRemoved ()V -accessible field net/minecraft/world/entity/Entity entityData Lnet/minecraft/network/syncher/SynchedEntityData; -accessible field net/minecraft/world/entity/Avatar DATA_PLAYER_MODE_CUSTOMISATION Lnet/minecraft/network/syncher/EntityDataAccessor; +accessWidener v1 official + +accessible class net/minecraft/world/entity/monster/Enderman$EndermanTakeBlockGoal +accessible method net/minecraft/world/entity/Entity unsetRemoved ()V +accessible field net/minecraft/world/entity/Entity entityData Lnet/minecraft/network/syncher/SynchedEntityData; +accessible field net/minecraft/world/entity/Avatar DATA_PLAYER_MODE_CUSTOMISATION Lnet/minecraft/network/syncher/EntityDataAccessor; + accessible field net/minecraft/stats/StatsCounter stats Lit/unimi/dsi/fastutil/objects/Object2IntMap; \ No newline at end of file