Open VapidLinus opened 7 years ago
Quick note that the only workaround I've found to prevent the item from dropping is to use SpawnEntityEvent
.
@Listener
public void onEntitySpawn(SpawnEntityEvent event) {
for (Entity entity : event.getEntities()) {
entity.get(Keys.REPRESENTED_ITEM).ifPresent(item -> {
if (item.getType() == ItemTypes.GREEN_SHULKER_BOX) {
event.setCancelled(true);
}
});
}
}
@VapidLinus In future, please bring up issues with the implementation in SpongeCommon. SpongeAPI is reserved for design issues/bugs / feature planning. Can you test this with Faiths recent change?
My fix was only for BlockSnapshot#restore (which is called by canceling events)
Calling
world.setBlockType(position, BlockTypes.AIR)
on a shulkerbox block causes the shulkerbox to drop as an item. This is inconsistent as other blocks do not cause items to drop.Trying to cancel this using
DropItemEvent
fails, because it never gets called during above scenario.Code to reproduce: