@Override
public void spawnItem( ItemStack itemStack, Location<World> spawnLocation, World world )
{
Optional<Entity> itemEntity = world.createEntity( EntityTypes.ITEM, spawnLocation.getPosition() );
if ( itemEntity.isPresent() )
{
Item items = (Item) itemEntity.get();
items.offer( Keys.REPRESENTED_ITEM, itemStack.createSnapshot() );
world.spawnEntity(
items, Cause.of( EntitySpawnCause.builder().entity( items ).type( SpawnTypes.PLUGIN ).build() ) );
}
else
{
logger.warn( "Unable to spawn item for itemstack {}", itemStack );
}
}
It works until up to the part where it tries to spawn the entity, where I get the following exception:
Could not pass ChangeBlockEvent$Break$Impl to Plugin{id=treebreaker, name=Sodium labs’ Treebreaker, version=0.1}
java.lang.IllegalArgumentException: Could not find a Supplier for the provided class: org.spongepowered.api.event.cause.entity.spawn.EntitySpawnCause.Builder
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:125) ~[minecraft_server.1.8.jar:?]
at org.spongepowered.common.registry.SpongeGameRegistry.createBuilder(SpongeGameRegistry.java:249) ~[SpongeGameRegistry.class:1.8-3.0.0-BETA-129]
at org.spongepowered.api.event.cause.entity.spawn.EntitySpawnCause.builder(EntitySpawnCause.java:34) ~[EntitySpawnCause.class:1.8-3.0.0-BETA-129]