mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 16:35:50 +00:00
feat: fake entity
This commit is contained in:
parent
d861d3e849
commit
1f937a2ae0
@ -0,0 +1,48 @@
|
||||
package org.allaymc.terra.allay.delegate;
|
||||
|
||||
import com.dfsek.terra.api.entity.Entity;
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
import com.dfsek.terra.api.world.ServerWorld;
|
||||
|
||||
|
||||
/**
|
||||
* Terra Project 2024/6/16
|
||||
*
|
||||
* @author daoge_cmd
|
||||
*/
|
||||
public final class AllayFakeEntity implements Entity {
|
||||
|
||||
private final Object fakeHandle = new Object();
|
||||
private Vector3 position;
|
||||
private ServerWorld world;
|
||||
|
||||
public AllayFakeEntity(Vector3 position, ServerWorld world) {
|
||||
this.position = position;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector3 position() {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void position(Vector3 position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void world(ServerWorld world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerWorld world() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getHandle() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package org.allaymc.terra.allay.delegate;
|
||||
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
|
||||
import org.allaymc.api.world.chunk.UnsafeChunk;
|
||||
import org.allaymc.terra.allay.Mapping;
|
||||
|
||||
@ -45,8 +47,7 @@ public record AllayProtoWorld(AllayServerWorld allayServerWorld, UnsafeChunk cen
|
||||
|
||||
@Override
|
||||
public Entity spawnEntity(double x, double y, double z, EntityType entityType) {
|
||||
// TODO
|
||||
return null;
|
||||
return new AllayFakeEntity(Vector3.of(x, y, z), allayServerWorld);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,7 @@
|
||||
package org.allaymc.terra.allay.delegate;
|
||||
|
||||
import com.dfsek.terra.api.util.vector.Vector3;
|
||||
|
||||
import org.allaymc.api.world.Dimension;
|
||||
import org.allaymc.terra.allay.Mapping;
|
||||
import org.allaymc.terra.allay.generator.AllayGeneratorWrapper;
|
||||
@ -34,8 +36,7 @@ public record AllayServerWorld(AllayGeneratorWrapper allayGeneratorWrapper, Dime
|
||||
|
||||
@Override
|
||||
public Entity spawnEntity(double x, double y, double z, EntityType entityType) {
|
||||
// TODO
|
||||
return null;
|
||||
return new AllayFakeEntity(Vector3.of(x, y, z), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user