|
13 | 13 | import net.fabricmc.fabric.api.networking.v1.ServerConfigurationNetworking; |
14 | 14 | import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; |
15 | 15 | import net.minecraft.entity.Entity; |
16 | | -import net.minecraft.entity.player.PlayerPosition; |
17 | 16 | import net.minecraft.network.PacketByteBuf; |
18 | 17 | import net.minecraft.network.codec.PacketCodec; |
19 | 18 | import net.minecraft.network.packet.CustomPayload; |
|
28 | 27 | import net.minecraft.server.world.ServerChunkLoadingManager; |
29 | 28 | import net.minecraft.text.Text; |
30 | 29 | import net.minecraft.util.Identifier; |
31 | | -import net.minecraft.util.math.Vec3d; |
32 | 30 | import org.slf4j.Logger; |
33 | 31 | import org.slf4j.LoggerFactory; |
34 | 32 | import xyz.eclipseisoffline.capecommand.mixin.EntityAccessor; |
35 | 33 | import xyz.eclipseisoffline.capecommand.mixin.ServerChunkLoadingManagerAccessor; |
36 | 34 | import xyz.eclipseisoffline.capecommand.mixin.ServerConfigurationNetworkHandlerAccessor; |
| 35 | +import xyz.eclipseisoffline.capecommand.mixin.ServerPlayerEntityAccessor; |
37 | 36 |
|
38 | 37 | import java.util.List; |
39 | 38 |
|
@@ -68,13 +67,19 @@ public void onInitialize() { |
68 | 67 |
|
69 | 68 | ServerPlayerEntity player = context.getSource().getPlayerOrThrow(); |
70 | 69 | if (cape.requiresClient() && !CONFIG.hasCapeCommand(player)) { |
71 | | - throw new SimpleCommandExceptionType(Text.of("This cape requires you to install the Cape Command mod locally.")).create(); |
| 70 | + throw new SimpleCommandExceptionType(Text.of("This cape requires you to install the Cape Command mod locally")).create(); |
72 | 71 | } |
73 | 72 |
|
74 | 73 | CONFIG.setPlayerCape(context.getSource().getPlayerOrThrow().getGameProfile(), cape); |
75 | 74 |
|
76 | 75 | reloadPlayerSkin(context.getSource()); |
77 | | - context.getSource().sendFeedback(() -> Text.of("Cape saved. Note that this cape is only visible to you and other players that have Cape Command installed."), true); |
| 76 | + context.getSource().sendFeedback(() -> Text.of("Now wearing cape \"" + capeString.toLowerCase() + "\""), true); |
| 77 | + |
| 78 | + if (CONFIG.isGeyserAvailable()) { |
| 79 | + context.getSource().sendFeedback(() -> Text.of("Note that this cape is only visible to you, bedrock players, and other Java players that have Cape Command installed"), false); |
| 80 | + } else { |
| 81 | + context.getSource().sendFeedback(() -> Text.of("Note that this cape is only visible to you and other players that have Cape Command installed"), false); |
| 82 | + } |
78 | 83 |
|
79 | 84 | return 0; |
80 | 85 | })) |
@@ -158,6 +163,9 @@ private void reloadPlayerSkin(ServerCommandSource source) throws CommandSyntaxEx |
158 | 163 | // Client clears these when respawning |
159 | 164 | source.getServer().getPlayerManager().sendPlayerStatus(player); |
160 | 165 | source.getServer().getPlayerManager().sendStatusEffects(player); |
| 166 | + ((ServerPlayerEntityAccessor) player).setSyncedExperience(-1); |
| 167 | + ((ServerPlayerEntityAccessor) player).setSyncedHealth(-1.0F); |
| 168 | + ((ServerPlayerEntityAccessor) player).setSyncedFoodLevel(-1); |
161 | 169 |
|
162 | 170 | continue; |
163 | 171 | } |
|
0 commit comments