Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Updated for latest Sponge API changes
Dieser Commit ist enthalten in:
Ursprung
51d44f42fd
Commit
89767aedf4
@ -198,16 +198,13 @@ 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()) {
|
entity.offer(Keys.REPRESENTED_ITEM, SpongeWorldEdit.toSpongeItemStack(item).createSnapshot());
|
||||||
org.spongepowered.api.entity.Entity entity = optItem.get();
|
getWorld().spawnEntity(entity, ENTITY_SPAWN_CAUSE);
|
||||||
entity.offer(Keys.REPRESENTED_ITEM, SpongeWorldEdit.toSpongeItemStack(item).createSnapshot());
|
|
||||||
getWorld().spawnEntity(entity, ENTITY_SPAWN_CAUSE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -277,24 +274,21 @@ 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()) {
|
if (entity.hasNbtData()) {
|
||||||
org.spongepowered.api.entity.Entity newEnt = optNewEnt.get();
|
applyEntityData(newEnt, entity);
|
||||||
if (entity.hasNbtData()) {
|
}
|
||||||
applyEntityData(newEnt, entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overwrite any data set by the NBT application
|
// Overwrite any data set by the NBT application
|
||||||
Vector dir = location.getDirection();
|
Vector dir = location.getDirection();
|
||||||
|
|
||||||
newEnt.setLocationAndRotation(
|
newEnt.setLocationAndRotation(
|
||||||
new org.spongepowered.api.world.Location<>(getWorld(), pos),
|
new org.spongepowered.api.world.Location<>(getWorld(), pos),
|
||||||
new Vector3d(dir.getX(), dir.getY(), dir.getZ())
|
new Vector3d(dir.getX(), dir.getY(), dir.getZ())
|
||||||
);
|
);
|
||||||
|
|
||||||
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;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren