当前位置: 首页>>代码示例>>Java>>正文


Java Items.BANNER属性代码示例

本文整理汇总了Java中net.minecraft.init.Items.BANNER属性的典型用法代码示例。如果您正苦于以下问题:Java Items.BANNER属性的具体用法?Java Items.BANNER怎么用?Java Items.BANNER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.init.Items的用法示例。


在下文中一共展示了Items.BANNER属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTileDataItemStack

@Nullable
private ItemStack getTileDataItemStack(World worldIn, BlockPos pos, IBlockState state)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBanner)
    {
        ItemStack itemstack = new ItemStack(Items.BANNER, 1, ((TileEntityBanner)tileentity).getBaseColor());
        NBTTagCompound nbttagcompound = tileentity.writeToNBT(new NBTTagCompound());
        nbttagcompound.removeTag("x");
        nbttagcompound.removeTag("y");
        nbttagcompound.removeTag("z");
        nbttagcompound.removeTag("id");
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        return itemstack;
    }
    else
    {
        return null;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:BlockBanner.java

示例2: harvestBlock

public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, @Nullable ItemStack stack)
{
    if (te instanceof TileEntityBanner)
    {
        TileEntityBanner tileentitybanner = (TileEntityBanner)te;
        ItemStack itemstack = new ItemStack(Items.BANNER, 1, ((TileEntityBanner)te).getBaseColor());
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, tileentitybanner.getBaseColor(), tileentitybanner.getPatterns());
        itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
        spawnAsEntity(worldIn, pos, itemstack);
    }
    else
    {
        super.harvestBlock(worldIn, player, pos, state, (TileEntity)null, stack);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:BlockBanner.java

示例3: getDrops

@Override
public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
{
    TileEntity te = world.getTileEntity(pos);

    java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
    if (te instanceof TileEntityBanner)
    {
        TileEntityBanner banner = (TileEntityBanner)te;
        ItemStack item = new ItemStack(Items.BANNER, 1, banner.getBaseColor());
        NBTTagCompound nbt = new NBTTagCompound();
        TileEntityBanner.setBaseColorAndPatterns(nbt, banner.getBaseColor(), banner.getPatterns());
        item.setTagInfo("BlockEntityTag", nbt);
        ret.add(item);
    }
    else
    {
        ret.add(new ItemStack(Items.BANNER, 1, 0));
    }
    return ret;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:BlockBanner.java

示例4: func_190910_a

public static ItemStack func_190910_a(EnumDyeColor p_190910_0_, @Nullable NBTTagList p_190910_1_)
{
    ItemStack itemstack = new ItemStack(Items.BANNER, 1, p_190910_0_.getDyeDamage());

    if (p_190910_1_ != null && !p_190910_1_.hasNoTags())
    {
        itemstack.func_190925_c("BlockEntityTag").setTag("Patterns", p_190910_1_.copy());
    }

    return itemstack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:ItemBanner.java

示例5: matches

public boolean matches(InventoryCrafting inv, World worldIn)
{
    boolean flag = false;

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack.getItem() == Items.BANNER)
        {
            if (flag)
            {
                return false;
            }

            if (TileEntityBanner.getPatterns(itemstack) >= 6)
            {
                return false;
            }

            flag = true;
        }
    }

    if (!flag)
    {
        return false;
    }
    else
    {
        return this.func_190933_c(inv) != null;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:33,代码来源:RecipesBanners.java

示例6: getCraftingResult

public ItemStack getCraftingResult(InventoryCrafting inv)
{
    ItemStack itemstack = ItemStack.field_190927_a;
    ItemStack itemstack1 = ItemStack.field_190927_a;

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack2 = inv.getStackInSlot(i);

        if (!itemstack2.func_190926_b())
        {
            if (itemstack2.getItem() == Items.BANNER)
            {
                itemstack = itemstack2;
            }
            else if (itemstack2.getItem() == Items.SHIELD)
            {
                itemstack1 = itemstack2.copy();
            }
        }
    }

    if (itemstack1.func_190926_b())
    {
        return itemstack1;
    }
    else
    {
        NBTTagCompound nbttagcompound = itemstack.getSubCompound("BlockEntityTag");
        NBTTagCompound nbttagcompound1 = nbttagcompound == null ? new NBTTagCompound() : nbttagcompound.copy();
        nbttagcompound1.setInteger("Base", itemstack.getMetadata() & 15);
        itemstack1.setTagInfo("BlockEntityTag", nbttagcompound1);
        return itemstack1;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:35,代码来源:ShieldRecipes.java

示例7: matches

/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    boolean flag = false;

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null && itemstack.getItem() == Items.BANNER)
        {
            if (flag)
            {
                return false;
            }

            if (TileEntityBanner.getPatterns(itemstack) >= 6)
            {
                return false;
            }

            flag = true;
        }
    }

    if (!flag)
    {
        return false;
    }
    else
    {
        return this.matchPatterns(inv) != null;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:36,代码来源:RecipesBanners.java

示例8: matches

public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = ItemStack.field_190927_a;
    ItemStack itemstack1 = ItemStack.field_190927_a;

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack2 = inv.getStackInSlot(i);

        if (!itemstack2.func_190926_b())
        {
            if (itemstack2.getItem() == Items.BANNER)
            {
                if (!itemstack1.func_190926_b())
                {
                    return false;
                }

                itemstack1 = itemstack2;
            }
            else
            {
                if (itemstack2.getItem() != Items.SHIELD)
                {
                    return false;
                }

                if (!itemstack.func_190926_b())
                {
                    return false;
                }

                if (itemstack2.getSubCompound("BlockEntityTag") != null)
                {
                    return false;
                }

                itemstack = itemstack2;
            }
        }
    }

    if (!itemstack.func_190926_b() && !itemstack1.func_190926_b())
    {
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:51,代码来源:ShieldRecipes.java

示例9: getItemDropped

/**
 * Get the Item that this Block should drop when harvested.
 */
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.BANNER;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:7,代码来源:BlockBanner.java

示例10: getItem

public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
{
    ItemStack itemstack = this.getTileDataItemStack(worldIn, pos);
    return itemstack.func_190926_b() ? new ItemStack(Items.BANNER) : itemstack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:BlockBanner.java

示例11: renderByItem

public void renderByItem(ItemStack itemStackIn)
{
    Item item = itemStackIn.getItem();

    if (item == Items.BANNER)
    {
        this.banner.setItemValues(itemStackIn, false);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
    }
    else if (item == Items.SHIELD)
    {
        if (itemStackIn.getSubCompound("BlockEntityTag") != null)
        {
            this.banner.setItemValues(itemStackIn, true);
            Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_DESIGNS.getResourceLocation(this.banner.getPatternResourceLocation(), this.banner.getPatternList(), this.banner.getColorList()));
        }
        else
        {
            Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_BASE_TEXTURE);
        }

        GlStateManager.pushMatrix();
        GlStateManager.scale(1.0F, -1.0F, -1.0F);
        this.modelShield.render();
        GlStateManager.popMatrix();
    }
    else if (item == Items.SKULL)
    {
        GameProfile gameprofile = null;

        if (itemStackIn.hasTagCompound())
        {
            NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();

            if (nbttagcompound.hasKey("SkullOwner", 10))
            {
                gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
            }
            else if (nbttagcompound.hasKey("SkullOwner", 8) && !StringUtils.isBlank(nbttagcompound.getString("SkullOwner")))
            {
                GameProfile gameprofile1 = new GameProfile((UUID)null, nbttagcompound.getString("SkullOwner"));
                gameprofile = TileEntitySkull.updateGameprofile(gameprofile1);
                nbttagcompound.removeTag("SkullOwner");
                nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
            }
        }

        if (TileEntitySkullRenderer.instance != null)
        {
            GlStateManager.pushMatrix();
            GlStateManager.disableCull();
            TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, EnumFacing.UP, 180.0F, itemStackIn.getMetadata(), gameprofile, -1, 0.0F);
            GlStateManager.enableCull();
            GlStateManager.popMatrix();
        }
    }
    else if (item == Item.getItemFromBlock(Blocks.ENDER_CHEST))
    {
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.enderChest, 0.0D, 0.0D, 0.0D, 0.0F);
    }
    else if (item == Item.getItemFromBlock(Blocks.TRAPPED_CHEST))
    {
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chestTrap, 0.0D, 0.0D, 0.0D, 0.0F);
    }
    else if (Block.getBlockFromItem(item) instanceof BlockShulkerBox)
    {
        TileEntityRendererDispatcher.instance.renderTileEntityAt(field_191274_b[BlockShulkerBox.func_190955_b(item).getMetadata()], 0.0D, 0.0D, 0.0D, 0.0F);
    }
    else
    {
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chestBasic, 0.0D, 0.0D, 0.0D, 0.0F);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:73,代码来源:TileEntityItemStackRenderer.java

示例12: matches

/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    ItemStack itemstack = null;
    ItemStack itemstack1 = null;

    for (int i = 0; i < inv.getSizeInventory(); ++i)
    {
        ItemStack itemstack2 = inv.getStackInSlot(i);

        if (itemstack2 != null)
        {
            if (itemstack2.getItem() == Items.BANNER)
            {
                if (itemstack1 != null)
                {
                    return false;
                }

                itemstack1 = itemstack2;
            }
            else
            {
                if (itemstack2.getItem() != Items.SHIELD)
                {
                    return false;
                }

                if (itemstack != null)
                {
                    return false;
                }

                if (itemstack2.getSubCompound("BlockEntityTag", false) != null)
                {
                    return false;
                }

                itemstack = itemstack2;
            }
        }
    }

    if (itemstack != null && itemstack1 != null)
    {
        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:54,代码来源:ShieldRecipes.java

示例13: getItemDropped

/**
 * Get the Item that this Block should drop when harvested.
 */
@Nullable
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
    return Items.BANNER;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:BlockBanner.java

示例14: getItem

public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
{
    ItemStack itemstack = this.getTileDataItemStack(worldIn, pos, state);
    return itemstack != null ? itemstack : new ItemStack(Items.BANNER);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:BlockBanner.java

示例15: renderByItem

public void renderByItem(ItemStack itemStackIn)
{
    if (itemStackIn.getItem() == Items.BANNER)
    {
        this.banner.setItemValues(itemStackIn);
        TileEntityRendererDispatcher.instance.renderTileEntityAt(this.banner, 0.0D, 0.0D, 0.0D, 0.0F);
    }
    else if (itemStackIn.getItem() == Items.SHIELD)
    {
        if (itemStackIn.getSubCompound("BlockEntityTag", false) != null)
        {
            this.banner.setItemValues(itemStackIn);
            Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_DESIGNS.getResourceLocation(this.banner.getPatternResourceLocation(), this.banner.getPatternList(), this.banner.getColorList()));
        }
        else
        {
            Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_BASE_TEXTURE);
        }

        GlStateManager.pushMatrix();
        GlStateManager.scale(1.0F, -1.0F, -1.0F);
        this.modelShield.render();
        GlStateManager.popMatrix();
    }
    else if (itemStackIn.getItem() == Items.SKULL)
    {
        GameProfile gameprofile = null;

        if (itemStackIn.hasTagCompound())
        {
            NBTTagCompound nbttagcompound = itemStackIn.getTagCompound();

            if (nbttagcompound.hasKey("SkullOwner", 10))
            {
                gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
            }
            else if (nbttagcompound.hasKey("SkullOwner", 8) && !nbttagcompound.getString("SkullOwner").isEmpty())
            {
                GameProfile lvt_2_2_ = new GameProfile((UUID)null, nbttagcompound.getString("SkullOwner"));
                gameprofile = TileEntitySkull.updateGameprofile(lvt_2_2_);
                nbttagcompound.removeTag("SkullOwner");
                nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
            }
        }

        if (TileEntitySkullRenderer.instance != null)
        {
            GlStateManager.pushMatrix();
            GlStateManager.disableCull();
            TileEntitySkullRenderer.instance.renderSkull(0.0F, 0.0F, 0.0F, EnumFacing.UP, 0.0F, itemStackIn.getMetadata(), gameprofile, -1, 0.0F);
            GlStateManager.enableCull();
            GlStateManager.popMatrix();
        }
    }
    else
    {
        Block block = Block.getBlockFromItem(itemStackIn.getItem());

        if (block == Blocks.ENDER_CHEST)
        {
            TileEntityRendererDispatcher.instance.renderTileEntityAt(this.enderChest, 0.0D, 0.0D, 0.0D, 0.0F);
        }
        else if (block == Blocks.TRAPPED_CHEST)
        {
            TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chestTrap, 0.0D, 0.0D, 0.0D, 0.0F);
        }
        else if (block != Blocks.CHEST) net.minecraftforge.client.ForgeHooksClient.renderTileItem(itemStackIn.getItem(), itemStackIn.getMetadata());
        else
        {
            TileEntityRendererDispatcher.instance.renderTileEntityAt(this.chestBasic, 0.0D, 0.0D, 0.0D, 0.0F);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:73,代码来源:TileEntityItemStackRenderer.java


注:本文中的net.minecraft.init.Items.BANNER属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。