I’m trying to spawn a red dyed leather pants item into the world that does not despawn.
Location<World> location = ...
World world = location.getExtent();
ItemStack itemStack = ItemStack.builder()
.itemType(ItemTypes.LEATHER_LEGGINGS)
.quantity(1)
.keyValue(Keys.DYE_COLOR, DyeColors.RED)
.keyValue(Keys.AGE, -1)
.build();
Item item = (Item) world.createEntity(EntityTypes.ITEM, location.getPosition());
item.offer(Keys.REPRESENTED_ITEM, itemStack.createSnapshot());
world.spawnEntity(item, Cause.source(EntitySpawnCause.builder().entity(item).type(SpawnTypes.PLUGIN).build()).build());
So I’m assuming .keyValue(Keys.DYE_COLOR, DyeColors.RED)
should dye the item red.
And .keyValue(Keys.AGE, -1)
should prevent the item from despawning?
If so, then I realise the AGE is not implemented yet (if I interpret this checklist correctly). DyeableData should be implemented though, right? But this spawns regular undyed leather leggings without color.
So my questions are what should be working and what not. And more importantly, if something isn’t implemented yet, are there any ways for me to work around it to get the same results (so to prevent an item from despawning, and to create dyed leather leggings itemstack).