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


Java TileEntityBanner.setBaseColorAndPatterns方法代码示例

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


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

示例1: harvestBlock

import net.minecraft.tileentity.TileEntityBanner; //导入方法依赖的package包/类
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,代码行数:17,代码来源:BlockBanner.java

示例2: getDrops

import net.minecraft.tileentity.TileEntityBanner; //导入方法依赖的package包/类
@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,代码行数:22,代码来源:BlockBanner.java

示例3: getSubItems

import net.minecraft.tileentity.TileEntityBanner; //导入方法依赖的package包/类
/**
 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
 */
@SideOnly(Side.CLIENT)
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
{
    for (EnumDyeColor enumdyecolor : EnumDyeColor.values())
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        TileEntityBanner.setBaseColorAndPatterns(nbttagcompound, enumdyecolor.getDyeDamage(), (NBTTagList)null);
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setTag("BlockEntityTag", nbttagcompound);
        ItemStack itemstack = new ItemStack(itemIn, 1, enumdyecolor.getDyeDamage());
        itemstack.setTagCompound(nbttagcompound1);
        subItems.add(itemstack);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:ItemBanner.java

示例4: createBanner

import net.minecraft.tileentity.TileEntityBanner; //导入方法依赖的package包/类
/**
 * Creates a new Banner ItemStack that has all of the patterns in the NBTTagList written to
 * it.
 *
 * @param baseColor The base color for the banner.
 * @param patterns The patterns to apply. This can be null if you want no patterns. See
 *        {@link #createPatternList(BannerLayer...)} for an easy way to make this.
 * @return The ItemStack that was created. All of the data is on the NBT.
 */
public static ItemStack createBanner (EnumDyeColor baseColor, NBTTagList patterns) {
    final ItemStack stack = new ItemStack(Items.BANNER, 1, baseColor.getDyeDamage());
    final NBTTagCompound blockTag = new NBTTagCompound();
    final NBTTagCompound stackTag = new NBTTagCompound();
    TileEntityBanner.setBaseColorAndPatterns(blockTag, baseColor.getDyeDamage(), patterns);
    stackTag.setTag("BlockEntityTag", blockTag);
    stack.setTagCompound(stackTag);
    return stack;
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:MMDLib-old,代码行数:19,代码来源:BannerUtils.java


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