MinecraftScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a script that teleports the plater to 000"
/* To teleport a player to coordinates (0, 0, 0) in Minecraft Forge, you can create a custom item that, when right-clicked, will teleport the player. Here's an example implementation: */ import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.Item; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; public class TeleportItem extends Item { public TeleportItem(Properties properties) { super(properties); } @Override public InteractionResult useOn(UseOnContext context) { Level world = context.getLevel(); if (!world.isClientSide) { BlockPos targetPos = new BlockPos(0, 0, 0); Vec3 targetVec = Vec3.atBottomCenterOf(targetPos); context.getPlayer().teleportTo(targetVec.x, targetVec.y, targetVec.z); } return InteractionResult.SUCCESS; } } /* To use this TeleportItem, you will need to register it in your mod's item registry and create an instance of it in-game. When the player right-clicks with this item, they will be teleported to the coordinates (0, 0, 0). */