|
41 | 41 | import net.minecraft.ChatFormatting; |
42 | 42 | import net.minecraft.commands.CommandSourceStack; |
43 | 43 | import net.minecraft.commands.arguments.item.ItemInput; |
| 44 | +import net.minecraft.core.BlockPos; |
44 | 45 | import net.minecraft.core.registries.Registries; |
45 | 46 | import net.minecraft.network.chat.ClickEvent; |
46 | 47 | import net.minecraft.network.chat.Component; |
|
49 | 50 | import net.minecraft.network.chat.MutableComponent; |
50 | 51 | import net.minecraft.network.chat.TextColor; |
51 | 52 | import net.minecraft.server.level.ServerPlayer; |
| 53 | +import net.minecraft.util.Mth; |
52 | 54 | import net.minecraft.world.level.ChunkPos; |
53 | 55 | import net.minecraft.world.level.biome.Biome; |
54 | 56 | import net.minecraft.world.phys.Vec3; |
@@ -121,7 +123,7 @@ public void onInitialize() { |
121 | 123 | ctx.sender().sendSuccess(() -> Component.literal("Yes, the biome ") |
122 | 124 | .append(Component.literal( |
123 | 125 | ctx.sender().registryAccess() |
124 | | - .registryOrThrow(Registries.BIOME) |
| 126 | + .lookupOrThrow(Registries.BIOME) |
125 | 127 | .getKey(ctx.get("biome")).toString()) |
126 | 128 | .withStyle(ChatFormatting.DARK_PURPLE, ChatFormatting.BOLD)) |
127 | 129 | .append(Component.literal(" is pretty cool")) |
@@ -269,8 +271,10 @@ public void onInitialize() { |
269 | 271 | .handler(ctx -> { |
270 | 272 | final MultipleEntitySelector selector = ctx.get("targets"); |
271 | 273 | final Vec3 location = ctx.<Coordinates>get("location").position(); |
272 | | - selector.values().forEach(target -> |
273 | | - target.teleportToWithTicket(location.x(), location.y(), location.z())); |
| 274 | + selector.values().forEach(target -> { |
| 275 | + target.placePortalTicket(new BlockPos(Mth.floor(location.x()), Mth.floor(location.y()), Mth.floor(location.z()))); |
| 276 | + target.teleportTo(location.x(), location.y(), location.z()); |
| 277 | + }); |
274 | 278 | })); |
275 | 279 |
|
276 | 280 | manager.command(base.literal("signed") |
@@ -309,7 +313,8 @@ public void onInitialize() { |
309 | 313 | } |
310 | 314 | final Vec3 vec = ctx.<ColumnCoordinates>get("chunk_position").position(); |
311 | 315 | final ChunkPos pos = new ChunkPos((int) vec.x(), (int) vec.z()); |
312 | | - player.teleportToWithTicket(pos.getMinBlockX(), 128, pos.getMinBlockZ()); |
| 316 | + player.placePortalTicket(new BlockPos(pos.getMinBlockX(), 128, pos.getMinBlockZ())); |
| 317 | + player.teleportTo(pos.getMinBlockX(), 128, pos.getMinBlockZ()); |
313 | 318 | })); |
314 | 319 | } |
315 | 320 | } |
0 commit comments