1.15.2 Add a custom_model_data to item in hand of armorstand in spawner

Discussion in 'Spigot Plugin Development' started by craterhater, Jan 18, 2020.

  1. Hey,

    I am using the following code to spawn a spawner with an armorstand in it. I need to give the item in hand a custom model data value. I do not know where I can find the correct tag to use for it. Can anyone point me in the right direction?

    Code (Text):
    public void setBlock() {
            Block block = location.getBlock();
            CraftWorld world = ((CraftWorld)block.getWorld());
            WorldServer worldServer = world.getHandle();
            BlockPosition blockPosition = new BlockPosition(block.getX(),block.getY(),block.getZ());
            TileEntityMobSpawner tileEntityMobSpawner = (TileEntityMobSpawner) worldServer.getTileEntity(blockPosition);
            MobSpawnerData mobSpawnerData = new MobSpawnerData();
            NBTTagCompound a = mobSpawnerData.getEntity();
            NBTTagList handList = new NBTTagList();
            NBTTagCompound mainHand = new NBTTagCompound();
            mainHand.setString("id", "minecraft:diamond_hoe");
            mainHand.setShort("Count", (short) 1);
            mainHand.setInt("CustomModelData", 1);
            NBTTagCompound spawnData = new NBTTagCompound();
            spawnData.setString("id", "minecraft:armor_stand");
            spawnData.set("HandItems", handList);
            tileEntityMobSpawner.getSpawner().requiredPlayerRange = 0;