mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-01-09 01:17:36 +00:00
Updated for latest Sponge API changes
This commit is contained in:
parent
51d44f42fd
commit
89767aedf4
@ -198,17 +198,14 @@ public abstract class SpongeWorld extends AbstractWorld {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<org.spongepowered.api.entity.Entity> optItem = getWorld().createEntity(
|
org.spongepowered.api.entity.Entity entity = getWorld().createEntity(
|
||||||
EntityTypes.ITEM,
|
EntityTypes.ITEM,
|
||||||
new Vector3d(position.getX(), position.getY(), position.getZ())
|
new Vector3d(position.getX(), position.getY(), position.getZ())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (optItem.isPresent()) {
|
|
||||||
org.spongepowered.api.entity.Entity entity = optItem.get();
|
|
||||||
entity.offer(Keys.REPRESENTED_ITEM, SpongeWorldEdit.toSpongeItemStack(item).createSnapshot());
|
entity.offer(Keys.REPRESENTED_ITEM, SpongeWorldEdit.toSpongeItemStack(item).createSnapshot());
|
||||||
getWorld().spawnEntity(entity, ENTITY_SPAWN_CAUSE);
|
getWorld().spawnEntity(entity, ENTITY_SPAWN_CAUSE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorldData getWorldData() {
|
public WorldData getWorldData() {
|
||||||
@ -277,9 +274,7 @@ public abstract class SpongeWorld extends AbstractWorld {
|
|||||||
EntityType entityType = Sponge.getRegistry().getType(EntityType.class, entity.getTypeId()).get();
|
EntityType entityType = Sponge.getRegistry().getType(EntityType.class, entity.getTypeId()).get();
|
||||||
Vector3d pos = new Vector3d(location.getX(), location.getY(), location.getZ());
|
Vector3d pos = new Vector3d(location.getX(), location.getY(), location.getZ());
|
||||||
|
|
||||||
Optional<org.spongepowered.api.entity.Entity> optNewEnt = world.createEntity(entityType, pos);
|
org.spongepowered.api.entity.Entity newEnt = world.createEntity(entityType, pos);
|
||||||
if (optNewEnt.isPresent()) {
|
|
||||||
org.spongepowered.api.entity.Entity newEnt = optNewEnt.get();
|
|
||||||
if (entity.hasNbtData()) {
|
if (entity.hasNbtData()) {
|
||||||
applyEntityData(newEnt, entity);
|
applyEntityData(newEnt, entity);
|
||||||
}
|
}
|
||||||
@ -295,7 +290,6 @@ public abstract class SpongeWorld extends AbstractWorld {
|
|||||||
if (world.spawnEntity(newEnt, ENTITY_SPAWN_CAUSE)) {
|
if (world.spawnEntity(newEnt, ENTITY_SPAWN_CAUSE)) {
|
||||||
return new SpongeEntity(newEnt);
|
return new SpongeEntity(newEnt);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user