9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 12:29:15 +00:00

添加dyed-color

This commit is contained in:
XiaoMoMi
2025-06-08 19:33:57 +08:00
parent 0eef225da6
commit a5d6ce8107
6 changed files with 67 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.CoreReflect
import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MBlocks;
import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MBuiltInRegistries;
import net.momirealms.craftengine.bukkit.plugin.reflection.minecraft.MRegistries;
import net.momirealms.craftengine.bukkit.plugin.user.BukkitServerPlayer;
import net.momirealms.craftengine.bukkit.util.BlockStateUtils;
import net.momirealms.craftengine.bukkit.util.KeyUtils;
import net.momirealms.craftengine.bukkit.util.RegistryUtils;
@@ -161,8 +162,8 @@ public class BukkitBlockManager extends AbstractBlockManager {
list.add(new TagUtils.TagEntry(entry.getKey(), entry.getValue()));
}
Object packet = TagUtils.createUpdateTagsPacket(Map.of(MRegistries.BLOCK, list));
for (Player player : Bukkit.getOnlinePlayers()) {
this.plugin.networkManager().sendPacket(this.plugin.adapt(player), packet);
for (BukkitServerPlayer player : this.plugin.networkManager().onlineUsers()) {
player.sendPacket(packet, false);
}
// 如果空,那么新来的玩家就没必要收到更新包了
if (list.isEmpty()) {

View File

@@ -179,6 +179,10 @@ public final class BlockGenerator {
if (CoreReflections.clazz$ServerLevel.isInstance(args[levelIndex])) {
startNoteBlockChain(args);
}
} else if (indicator.isTripwire()) {
if (CoreReflections.clazz$ServerLevel.isInstance(args[posIndex])) {
}
}
try {
return holder.value().updateShape(thisObj, args, superMethod);

View File

@@ -1106,13 +1106,13 @@ public class PacketConsumers {
Object blockPos = FastNMS.INSTANCE.field$ServerboundPlayerActionPacket$pos(packet);
BlockPos pos = LocationUtils.fromBlockPos(blockPos);
if (VersionHelper.isFolia()) {
BukkitCraftEngine.instance().scheduler().sync().run(() -> {
platformPlayer.getScheduler().run(BukkitCraftEngine.instance().javaPlugin(), (t) -> {
try {
handlePlayerActionPacketOnMainThread(player, world, pos, packet);
} catch (Exception e) {
CraftEngine.instance().logger().warn("Failed to handle ServerboundPlayerActionPacket", e);
}
}, world, pos.x() >> 4, pos.z() >> 4);
}, () -> {});
} else {
handlePlayerActionPacketOnMainThread(player, world, pos, packet);
}