mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Use a fixed entity spawn cause of PLUGIN type for creating entities
This commit is contained in:
parent
d1e9446d47
commit
03819a2342
@ -44,6 +44,8 @@ import org.spongepowered.api.data.property.block.SkyLuminanceProperty;
|
|||||||
import org.spongepowered.api.entity.EntityType;
|
import org.spongepowered.api.entity.EntityType;
|
||||||
import org.spongepowered.api.entity.EntityTypes;
|
import org.spongepowered.api.entity.EntityTypes;
|
||||||
import org.spongepowered.api.event.cause.Cause;
|
import org.spongepowered.api.event.cause.Cause;
|
||||||
|
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause;
|
||||||
|
import org.spongepowered.api.event.cause.entity.spawn.SpawnTypes;
|
||||||
import org.spongepowered.api.world.World;
|
import org.spongepowered.api.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -262,6 +264,8 @@ public abstract class SpongeWorld extends AbstractWorld {
|
|||||||
|
|
||||||
protected abstract void applyEntityData(org.spongepowered.api.entity.Entity entity, BaseEntity data);
|
protected abstract void applyEntityData(org.spongepowered.api.entity.Entity entity, BaseEntity data);
|
||||||
|
|
||||||
|
private static final Cause ENTITY_SPAWN_CAUSE = Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build();
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Entity createEntity(Location location, BaseEntity entity) {
|
public Entity createEntity(Location location, BaseEntity entity) {
|
||||||
@ -285,7 +289,7 @@ public abstract class SpongeWorld extends AbstractWorld {
|
|||||||
new Vector3d(dir.getX(), dir.getY(), dir.getZ())
|
new Vector3d(dir.getX(), dir.getY(), dir.getZ())
|
||||||
);
|
);
|
||||||
|
|
||||||
if (world.spawnEntity(newEnt, Cause.source(SpongeWorldEdit.container()).build())) {
|
if (world.spawnEntity(newEnt, ENTITY_SPAWN_CAUSE)) {
|
||||||
return new SpongeEntity(newEnt);
|
return new SpongeEntity(newEnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user