feat: fake entity

This commit is contained in:
daoge_cmd 2024-06-16 15:55:28 +08:00
parent d861d3e849
commit 1f937a2ae0
3 changed files with 54 additions and 4 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -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