spawn entity in serverworld with no world object

This commit is contained in:
dfsek
2022-06-07 15:05:47 -07:00
parent 372931a9c5
commit c468054bbe

View File

@@ -42,8 +42,7 @@ import com.dfsek.terra.fabric.util.FabricUtil;
@Implements(@Interface(iface = ServerWorld.class, prefix = "terra$")) @Implements(@Interface(iface = ServerWorld.class, prefix = "terra$"))
public abstract class ServerWorldMixin { public abstract class ServerWorldMixin {
public Entity terra$spawnEntity(double x, double y, double z, EntityType entityType) { public Entity terra$spawnEntity(double x, double y, double z, EntityType entityType) {
net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create( net.minecraft.entity.Entity entity = ((net.minecraft.entity.EntityType<?>) entityType).create(null);
((net.minecraft.server.world.ServerWorld) (Object) this));
entity.setPos(x, y, z); entity.setPos(x, y, z);
((net.minecraft.server.world.ServerWorld) (Object) this).spawnEntity(entity); ((net.minecraft.server.world.ServerWorld) (Object) this).spawnEntity(entity);
return (Entity) entity; return (Entity) entity;