mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-15 21:31:05 +00:00
implement entity teleportation and biome locate
This commit is contained in:
@@ -5,6 +5,8 @@ import com.dfsek.terra.api.platform.entity.Entity;
|
||||
import com.dfsek.terra.api.platform.world.World;
|
||||
import com.dfsek.terra.fabric.world.FabricAdapter;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricWorldAccess;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricWorldHandle;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
|
||||
public class FabricEntity implements Entity {
|
||||
private final net.minecraft.entity.Entity delegate;
|
||||
@@ -28,6 +30,12 @@ public class FabricEntity implements Entity {
|
||||
return new Location(new FabricWorldAccess(delegate.world), FabricAdapter.adapt(delegate.getBlockPos()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocation(Location location) {
|
||||
delegate.teleport(location.getX(), location.getY(), location.getZ());
|
||||
delegate.moveToWorld((ServerWorld) ((FabricWorldHandle) location).getWorld());
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return new FabricWorldAccess(delegate.world);
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.dfsek.terra.api.platform.entity.Player;
|
||||
import com.dfsek.terra.api.platform.world.World;
|
||||
import com.dfsek.terra.fabric.world.FabricAdapter;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricWorldAccess;
|
||||
import com.dfsek.terra.fabric.world.handles.world.FabricWorldHandle;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
||||
public class FabricPlayer implements Player {
|
||||
@@ -34,4 +36,10 @@ public class FabricPlayer implements Player {
|
||||
public World getWorld() {
|
||||
return new FabricWorldAccess(delegate.world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocation(Location location) {
|
||||
delegate.teleport(location.getX(), location.getY(), location.getZ());
|
||||
delegate.moveToWorld((ServerWorld) ((FabricWorldHandle) location).getWorld());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user