本文整理汇总了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;
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例9: getItemDropped
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Items.BANNER;
}
示例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;
}
示例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);
}
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
}
}