Search in sources :

Example 1 with WoolCarpetBlock

use of net.minecraft.world.level.block.WoolCarpetBlock in project MyPet by xXKeyleXx.

the class EntityMyTraderLlama method updateVisuals.

@Override
public void updateVisuals() {
    this.getEntityData().set(CHEST_WATCHER, getMyPet().hasChest());
    this.getEntityData().set(AGE_WATCHER, getMyPet().isBaby());
    if (getMyPet().hasDecor()) {
        ItemStack is = CraftItemStack.asNMSCopy(getMyPet().getDecor());
        Block block = Block.byItem(is.getItem());
        int color = block instanceof WoolCarpetBlock ? ((WoolCarpetBlock) block).getColor().getId() : 0;
        this.getEntityData().set(COLOR_WATCHER, color);
    } else {
        this.getEntityData().set(COLOR_WATCHER, -1);
    }
    this.getEntityData().set(VARIANT_WATCHER, getMyPet().getVariant());
}
Also used : WoolCarpetBlock(net.minecraft.world.level.block.WoolCarpetBlock) WoolCarpetBlock(net.minecraft.world.level.block.WoolCarpetBlock) Block(net.minecraft.world.level.block.Block) ItemStack(net.minecraft.world.item.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack)

Example 2 with WoolCarpetBlock

use of net.minecraft.world.level.block.WoolCarpetBlock in project MyPet by xXKeyleXx.

the class EntityMyLlama method updateVisuals.

@Override
public void updateVisuals() {
    this.getEntityData().set(CHEST_WATCHER, getMyPet().hasChest());
    this.getEntityData().set(AGE_WATCHER, getMyPet().isBaby());
    if (getMyPet().hasDecor()) {
        ItemStack is = CraftItemStack.asNMSCopy(getMyPet().getDecor());
        Block block = Block.byItem(is.getItem());
        int color = block instanceof WoolCarpetBlock ? ((WoolCarpetBlock) block).getColor().getId() : 0;
        this.getEntityData().set(COLOR_WATCHER, color);
    } else {
        this.getEntityData().set(COLOR_WATCHER, -1);
    }
    this.getEntityData().set(VARIANT_WATCHER, getMyPet().getVariant());
}
Also used : WoolCarpetBlock(net.minecraft.world.level.block.WoolCarpetBlock) WoolCarpetBlock(net.minecraft.world.level.block.WoolCarpetBlock) Block(net.minecraft.world.level.block.Block) CraftItemStack(org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack) ItemStack(net.minecraft.world.item.ItemStack)

Example 3 with WoolCarpetBlock

use of net.minecraft.world.level.block.WoolCarpetBlock in project MyPet by xXKeyleXx.

the class EntityMyTraderLlama method updateVisuals.

@Override
public void updateVisuals() {
    this.getEntityData().set(CHEST_WATCHER, getMyPet().hasChest());
    this.getEntityData().set(AGE_WATCHER, getMyPet().isBaby());
    if (getMyPet().hasDecor()) {
        ItemStack is = CraftItemStack.asNMSCopy(getMyPet().getDecor());
        Block block = Block.byItem(is.getItem());
        int color = block instanceof WoolCarpetBlock ? ((WoolCarpetBlock) block).getColor().getId() : 0;
        this.getEntityData().set(COLOR_WATCHER, color);
    } else {
        this.getEntityData().set(COLOR_WATCHER, -1);
    }
    this.getEntityData().set(VARIANT_WATCHER, getMyPet().getVariant());
}
Also used : WoolCarpetBlock(net.minecraft.world.level.block.WoolCarpetBlock) WoolCarpetBlock(net.minecraft.world.level.block.WoolCarpetBlock) Block(net.minecraft.world.level.block.Block) CraftItemStack(org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack) ItemStack(net.minecraft.world.item.ItemStack)

Example 4 with WoolCarpetBlock

use of net.minecraft.world.level.block.WoolCarpetBlock in project MyPet by xXKeyleXx.

the class EntityMyLlama method updateVisuals.

@Override
public void updateVisuals() {
    this.getEntityData().set(CHEST_WATCHER, getMyPet().hasChest());
    this.getEntityData().set(AGE_WATCHER, getMyPet().isBaby());
    if (getMyPet().hasDecor()) {
        ItemStack is = CraftItemStack.asNMSCopy(getMyPet().getDecor());
        Block block = Block.byItem(is.getItem());
        int color = block instanceof WoolCarpetBlock ? ((WoolCarpetBlock) block).getColor().getId() : 0;
        this.getEntityData().set(COLOR_WATCHER, color);
    } else {
        this.getEntityData().set(COLOR_WATCHER, -1);
    }
    this.getEntityData().set(VARIANT_WATCHER, getMyPet().getVariant());
}
Also used : WoolCarpetBlock(net.minecraft.world.level.block.WoolCarpetBlock) WoolCarpetBlock(net.minecraft.world.level.block.WoolCarpetBlock) Block(net.minecraft.world.level.block.Block) ItemStack(net.minecraft.world.item.ItemStack) CraftItemStack(org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack)

Aggregations

ItemStack (net.minecraft.world.item.ItemStack)4 Block (net.minecraft.world.level.block.Block)4 WoolCarpetBlock (net.minecraft.world.level.block.WoolCarpetBlock)4 CraftItemStack (org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack)2 CraftItemStack (org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack)2