wip: 迁移到 26.1.2(第一批:构建配置+简单命令类)
build / build (push) Has been cancelled

已改:accessWidener/ fabric.mod.json/ HatCommand/ SitCommand/ util 接口/ 映射表文档。剩余源码待迁移。
This commit is contained in:
AxTps committed 2026-10-02 23:39:00 +08:00
1 parent 88aaea801c
commit a1a2103f47
8 files changed
+156 -50

No files matched your search

+111
View File
@@ -0,0 +1,111 @@
# Yarn → Mojang official 映射表(1.21 → 26.1.2)
> 26.1.2 起 Fabric 弃用 Yarn,改用 Mojang 官方映射(jar 未混淆)。
> 本表记录本 mod 迁移用到的类名对照。⚠️ 表示结构/语义有变化,需人工核对。
## block
- block.BlockState → world.level.block.state.BlockState
- block.Blocks → world.level.block.Blocks
- block.MushroomPlantBlock → world.level.block.MushroomBlock
- block.RedstoneWireBlock → world.level.block.RedStoneWireBlock
- block.ShulkerBoxBlock → world.level.block.ShulkerBoxBlock
- block.entity.BlockEntity → world.level.block.entity.BlockEntity
- block.entity.EndGatewayBlockEntity → world.level.block.entity.TheEndGatewayBlockEntity
- block.entity.EndPortalBlockEntity → world.level.block.entity.TheEndPortalBlockEntity
- block.enums.TrialSpawnerState → world.level.block.entity.trialspawner.TrialSpawnerState
- block.pattern.BlockPattern → world.level.block.state.pattern.BlockPattern
- block.pattern.CachedBlockPosition → world.level.block.state.pattern.BlockPattern$BlockCacheLoader ⚠️
- block.spawner.TrialSpawnerConfig → world.level.block.entity.trialspawner.TrialSpawnerConfig
- block.spawner.TrialSpawnerData → world.level.block.entity.trialspawner.TrialSpawnerStateData ⚠️
- block.spawner.TrialSpawnerLogic → world.level.block.entity.trialspawner.TrialSpawner ⚠️
## command
- command.CommandRegistryAccess → commands.CommandBuildContext ⚠️
- command.argument.* → commands.arguments.*
- server.command.ServerCommandSource → commands.CommandSourceStack
- server.command.CommandManager → commands.Commands
- command.CommandSource.suggestMatching → commands.SharedSuggestionProvider 方法 ⚠️
## component / nbt / text / util
- component.DataComponentTypes → core.component.DataComponentTypes
- nbt.NbtCompound → nbt.CompoundTag
- nbt.NbtElement → nbt.Tag
- text.Text → network.chat.Component
- text.Style → network.chat.Style
- util.Formatting → ChatFormatting
- util.math.BlockPos → core.BlockPos
- util.math.Direction → core.Direction
- util.math.MathHelper → util.Mth
- util.math.Vec2f → world.phys.Vec2
- util.math.Vec3d → world.phys.Vec3
- util.UserCache → server.players.GameProfileCache ⚠️
- util.Uuids → core.UUIDUtil
- util.Nameable → world.Nameable
- registry.RegistryKey → resources.ResourceKey
- registry.tag.TagKey → tags.TagKey
- registry.tag.BlockTags → tags.BlockTags
- SharedConstants → SharedConstants
## entity
- entity.Entity → world.entity.Entity
- entity.EntityType → world.entity.EntityType
- entity.EquipmentSlot → world.entity.EquipmentSlot
- entity.FallingBlockEntity → world.entity.item.FallingBlockEntity
- entity.ItemEntity → world.entity.item.ItemEntity
- entity.Leashable → world.entity.Leashable
- entity.LivingEntity → world.entity.LivingEntity
- entity.attribute.EntityAttributes → world.entity.ai.attributes.Attributes ⚠️
- entity.boss.dragon.EnderDragonFight → world.level.dimension.end.EnderDragonFight
- entity.damage.DamageSource → world.damagesource.DamageSource
- entity.decoration.ArmorStandEntity → world.entity.decoration.ArmorStand
- entity.decoration.EndCrystalEntity → world.entity.EndCrystal ⚠️
- entity.mob.EndermanEntity → world.entity.monster.EnderMan
- entity.mob.MobEntity → world.entity.Mob
- entity.passive.AnimalEntity → world.entity.animal.Animal
- entity.passive.ArmadilloEntity → world.entity.animal.Armadillo ⚠️
- entity.player.PlayerAbilities → world.entity.player.Abilities
- entity.player.PlayerEntity → world.entity.player.Player
- entity.player.PlayerInventory → world.entity.player.Inventory
- entity.vehicle.BoatEntity → world.entity.vehicle.Boat ⚠️
## item / inventory / screen
- inventory.Inventory → world.entity.player.Inventory
- item.BlockItem → world.item.BlockItem
- item.ElytraItem → world.item.ElytraItem ⚠️
- item.Equipment → world.item.Equipment ⚠️
- item.Item → world.item.Item
- item.ItemStack → world.item.ItemStack
- item.Items → world.item.Items
- screen.AnvilScreenHandler → world.inventory.AnvilMenu
- screen.ScreenHandler → world.inventory.AbstractContainerMenu
- screen.slot.Slot → world.inventory.Slot
## network
- network.NetworkSide → network.protocol.PacketFlow
- network.packet.c2s.common.SyncedClientOptions → server.level.ClientInformation
- network.packet.s2c.play.EntityPositionS2CPacket → network.protocol.game.ClientboundMoveEntityPacket
- network.packet.s2c.play.EntitySetHeadYawS2CPacket → network.protocol.game.ClientboundRotateHeadPacket
- network.packet.s2c.play.EntityTrackerUpdateS2CPacket → network.protocol.game.ClientboundSetEntityDataPacket
- network.packet.s2c.play.PlayerListS2CPacket → network.protocol.game.ClientboundPlayerInfoUpdatePacket
- server.network.ConnectedClientData → server.network.CommonListenerCookie ⚠️
- server.network.ServerPlayNetworkHandler → server.network.ServerGamePacketListenerImpl
- server.network.ServerPlayerEntity → server.level.ServerPlayer
## server / world
- server.MinecraftServer → server.MinecraftServer
- server.PlayerManager → server.players.PlayerList
- server.world.ServerWorld → server.level.ServerLevel
- server.world.SleepManager → server.players.SleepStatus ⚠️
- world.World → world.level.Level
- world.WorldView → world.level.LevelReader
- world.GameMode → world.level.GameType
- world.SpawnHelper → world.level.NaturalSpawner
- world.chunk.WorldChunk → world.level.chunk.LevelChunk
- world.Heightmap → world.level.levelgen.Heightmap
- world.dimension.NetherPortal → world.level.block.NetherPortalBlock ⚠️
- world.gen.feature.EndPortalFeature → world.level.levelgen.feature.EndPodiumFeature
- sound.SoundCategory → sounds.SoundSource
- sound.SoundEvents → sounds.SoundEvents
- resource.ResourcePackProfile → server.packs.* ⚠️
- resource.ResourceType → server.packs.PackType
- resource.VanillaResourcePackProvider → server.packs.vanilla.VanillaPackResources ⚠️
@@ -2,29 +2,28 @@ package com.github.zly2006.carpetslsaddition.command;
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ItemStack;
public class HatCommand {
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
dispatcher.register(CommandManager.literal("hat")
.requires(ServerCommandSource::isExecutedByPlayer)
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
dispatcher.register(Commands.literal("hat")
.requires(CommandSourceStack::isPlayer)
.requires((commandSource) -> SLSCarpetSettings.canUseHatCommand)
.executes(context -> {
ServerPlayerEntity player = context.getSource().getPlayer();
ServerPlayer player = context.getSource().getPlayer();
assert player != null;
ItemStack stack = player.getMainHandStack();
ItemStack head = player.getEquippedStack(EquipmentSlot.HEAD);
player.equipStack(EquipmentSlot.HEAD, stack);
player.getInventory().setStack(player.getInventory().selectedSlot, head);
player.currentScreenHandler.syncState();
ItemStack stack = player.getMainHandItem();
ItemStack head = player.getItemBySlot(EquipmentSlot.HEAD);
player.setItemSlot(EquipmentSlot.HEAD, stack);
player.getInventory().setItem(player.getInventory().getSelectedSlot(), head);
player.containerMenu.sendAllDataToRemote();
return 1;
}
)
})
);
}
}
}
@@ -3,35 +3,35 @@ package com.github.zly2006.carpetslsaddition.command;
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
import com.github.zly2006.carpetslsaddition.util.SitEntity;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.world.World;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.decoration.ArmorStand;
public class SitCommand {
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
dispatcher.register(CommandManager.literal("sit")
.requires(ServerCommandSource::isExecutedByPlayer)
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
dispatcher.register(Commands.literal("sit")
.requires(CommandSourceStack::isPlayer)
.requires((commandSource) -> SLSCarpetSettings.canUseSitCommand)
.executes(context -> {
ServerPlayerEntity player = context.getSource().getPlayer();
ServerPlayer player = context.getSource().getPlayer();
assert player != null;
if (player.getVehicle() != null || !player.isOnGround()) { // 防止错误的坐下行为
if (player.getVehicle() != null || !player.onGround()) { // 防止错误的坐下行为
return 1;
}
World world = player.getWorld();
ServerLevel world = (ServerLevel) player.level();
ArmorStandEntity armorStandEntity = new ArmorStandEntity(world, player.getX(), player.getY(), player.getZ());
ArmorStand armorStandEntity = new ArmorStand(world, player.getX(), player.getY(), player.getZ());
((SitEntity) armorStandEntity).setSitEntity(true);
world.spawnEntity(armorStandEntity);
player.setSneaking(false);
world.addFreshEntity(armorStandEntity);
player.setShiftKeyDown(false);
player.startRiding(armorStandEntity);
return 1;
})
);
}
}
}
@@ -4,4 +4,4 @@ public interface SitEntity {
boolean isSitEntity();
void setSitEntity(boolean sitEntity);
}
}
@@ -1,7 +1,7 @@
package com.github.zly2006.carpetslsaddition.util.access;
import net.minecraft.text.Text;
import net.minecraft.network.chat.Component;
public interface PlayerAccessor {
void carpet_SLS_Addition$setDisplayName(Text name);
}
void carpet_SLS_Addition$setDisplayName(Component name);
}
@@ -5,4 +5,4 @@ public interface SLSBotAccessor {
void carpet_SLS_Addition$setBot(boolean isBot);
long carpet_SLS_Addition$getSpawnTime();
void carpet_SLS_Addition$setSpawnTime(long spawnTime);
}
}
+4 -7
View File
@@ -27,13 +27,10 @@
],
"depends": {
"fabricloader": ">=0.15.1",
"fabricloader": ">=0.19.3",
"fabric-api": "*",
"minecraft": ">=1.21",
"java": ">=21",
"minecraft": ">=26.1",
"java": ">=25",
"carpet": "*"
},
"suggests": {
"another-mod": "*"
}
}
}
+5 -6
View File
@@ -1,6 +1,5 @@
accessWidener v1 named
accessible class net/minecraft/world/block/ChainRestrictedNeighborUpdater$Entry
accessible class net/minecraft/entity/mob/EndermanEntity$PickUpBlockGoal
accessible method net/minecraft/entity/Entity unsetRemoved ()V
accessible field net/minecraft/entity/player/PlayerEntity PLAYER_MODEL_PARTS Lnet/minecraft/entity/data/TrackedData;
accessible field net/minecraft/block/spawner/TrialSpawnerData spawnedMobsAlive Ljava/util/Set;
accessWidener v1 official
accessible class net/minecraft/world/entity/monster/EnderMan$EndermanTakeBlockGoal
accessible field net/minecraft/world/entity/Entity entityData Lnet/minecraft/network/syncher/SynchedEntityData;
accessible field net/minecraft/server/level/ServerPlayer DATA_PLAYER_MODE_CUSTOMISATION Lnet/minecraft/network/syncher/EntityDataAccessor;