本文整理汇总了Java中net.minecraft.init.Items.SKULL属性的典型用法代码示例。如果您正苦于以下问题:Java Items.SKULL属性的具体用法?Java Items.SKULL怎么用?Java Items.SKULL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.init.Items
的用法示例。
在下文中一共展示了Items.SKULL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: skull
protected static ItemStack skull(String name, String owner, String texture)
{
ItemStack stack = new ItemStack(Items.SKULL, 1, 3);
NBTTagCompound display = new NBTTagCompound();
display.setString("LocName", name);
stack.setTagInfo("display", display);
NBTTagCompound skullOwner = new NBTTagCompound();
skullOwner.setString("Id", owner);
NBTTagCompound properties = new NBTTagCompound();
NBTTagList textures = new NBTTagList();
NBTTagCompound tex = new NBTTagCompound();
tex.setString("Value", texture);
textures.appendTag(tex);
properties.setTag("textures", textures);
skullOwner.setTag("Properties", properties);
stack.setTagInfo("SkullOwner", skullOwner);
return stack;
}
示例2: storeTEInStack
private ItemStack storeTEInStack(ItemStack stack, TileEntity te)
{
NBTTagCompound nbttagcompound = te.writeToNBT(new NBTTagCompound());
if (stack.getItem() == Items.SKULL && nbttagcompound.hasKey("Owner"))
{
NBTTagCompound nbttagcompound2 = nbttagcompound.getCompoundTag("Owner");
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
nbttagcompound3.setTag("SkullOwner", nbttagcompound2);
stack.setTagCompound(nbttagcompound3);
return stack;
}
else
{
stack.setTagInfo("BlockEntityTag", nbttagcompound);
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
NBTTagList nbttaglist = new NBTTagList();
nbttaglist.appendTag(new NBTTagString("(+NBT)"));
nbttagcompound1.setTag("Lore", nbttaglist);
stack.setTagInfo("display", nbttagcompound1);
return stack;
}
}
示例3: getDyeCraftingResult
private static ItemStack getDyeCraftingResult(int meta) {
switch (meta) {
default: return new ItemStack(Items.GHAST_TEAR);
case 1: return new ItemStack(Items.FIRE_CHARGE, 8, 0);
case 2: return new ItemStack(Items.DRAGON_BREATH);
case 3: return new ItemStack(Items.DIAMOND);
case 4: return new ItemStack(Items.GOLD_INGOT);
case 5: return new ItemStack(Items.SLIME_BALL, 4, 0);
case 6: return new ItemStack(Items.SADDLE);
case 7: return new ItemStack(Blocks.CLAY, 8, 0);
case 8: return new ItemStack(Items.IRON_INGOT, 2, 0);
case 9: return new ItemStack(Blocks.STAINED_HARDENED_CLAY, 16, EnumDyeColor.CYAN.getMetadata());
case 10: return new ItemStack(Items.CHORUS_FRUIT);
case 11: return new ItemStack(Blocks.PRISMARINE, 8, 0);
case 12: return new ItemStack(Blocks.DIRT, 3, 0);
case 13: return new ItemStack(Items.EMERALD);
case 14: return new ItemStack(Items.NETHER_WART);
case 15: return new ItemStack(Items.SKULL, 1, 1);
}
}
示例4: storeTEInStack
public ItemStack storeTEInStack(ItemStack stack, TileEntity te)
{
NBTTagCompound nbttagcompound = te.writeToNBT(new NBTTagCompound());
if (stack.getItem() == Items.SKULL && nbttagcompound.hasKey("Owner"))
{
NBTTagCompound nbttagcompound2 = nbttagcompound.getCompoundTag("Owner");
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
nbttagcompound3.setTag("SkullOwner", nbttagcompound2);
stack.setTagCompound(nbttagcompound3);
return stack;
}
else
{
stack.setTagInfo("BlockEntityTag", nbttagcompound);
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
NBTTagList nbttaglist = new NBTTagList();
nbttaglist.appendTag(new NBTTagString("(+NBT)"));
nbttagcompound1.setTag("Lore", nbttaglist);
stack.setTagInfo("display", nbttagcompound1);
return stack;
}
}
示例5: getSkullDrop
public static ItemStack getSkullDrop(EntityLivingBase entity) {
if (entity instanceof EntitySkeleton) {
return new ItemStack(Items.SKULL, 1, 0);
}
if (entity instanceof EntityWitherSkeleton) {
return new ItemStack(Items.SKULL, 1, 1);
}
if (entity instanceof EntityZombie) {
return new ItemStack(Items.SKULL, 1, 2);
}
if (entity instanceof EntityCreeper) {
return new ItemStack(Items.SKULL, 1, 4);
}
if (entity instanceof EntityPlayer) {
ItemStack head = new ItemStack(Items.SKULL, 1, 3);
NBTTagCompound nametag = new NBTTagCompound();
nametag.setString("SkullOwner", entity.getDisplayName().getFormattedText());
head.setTagCompound(nametag);
return head;
}
if (entity instanceof EntityDragon) {
return new ItemStack(Items.SKULL, 1, 5);
}
if (entity instanceof EntityEnderman) {
if (entity instanceof EntityEvolvedEnderman) {
return new ItemStack(ModItems.SKULL_EVOLVED_ENDERMAN);
}
return new ItemStack(ModItems.SKULL_ENDERMAN);
}
if (entity instanceof EntityFrienderman) {
return new ItemStack(ModItems.SKULL_FRIENDERMAN);
}
return null;
}
示例6: getItem
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state)
{
int i = 0;
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntitySkull)
{
i = ((TileEntitySkull)tileentity).getSkullType();
}
return new ItemStack(Items.SKULL, 1, i);
}
示例7: getDrops
public java.util.List<ItemStack> getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune)
{
java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
{
if (!((Boolean)state.getValue(NODROP)).booleanValue())
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntitySkull)
{
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
ItemStack itemstack = new ItemStack(Items.SKULL, 1, tileentityskull.getSkullType());
if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null)
{
itemstack.setTagCompound(new NBTTagCompound());
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTUtil.writeGameProfile(nbttagcompound, tileentityskull.getPlayerProfile());
itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
ret.add(itemstack);
}
}
}
return ret;
}
示例8: getSlotForItemStack
public static EntityEquipmentSlot getSlotForItemStack(ItemStack stack)
{
return stack.getItem() != Item.getItemFromBlock(Blocks.PUMPKIN) && stack.getItem() != Items.SKULL ? (stack.getItem() instanceof ItemArmor ? ((ItemArmor)stack.getItem()).armorType : (stack.getItem() == Items.ELYTRA ? EntityEquipmentSlot.CHEST : (stack.getItem() == Items.SHIELD ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND))) : EntityEquipmentSlot.HEAD;
}
示例9: func_190732_dj
protected ItemStack func_190732_dj()
{
return new ItemStack(Items.SKULL, 1, 2);
}
示例10: getItemDropped
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Items.SKULL;
}
示例11: doRenderLayer
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (!itemstack.func_190926_b())
{
Item item = itemstack.getItem();
Minecraft minecraft = Minecraft.getMinecraft();
GlStateManager.pushMatrix();
if (entitylivingbaseIn.isSneaking())
{
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombieVillager;
if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager))
{
float f = 2.0F;
float f1 = 1.4F;
GlStateManager.translate(0.0F, 0.5F * scale, 0.0F);
GlStateManager.scale(0.7F, 0.7F, 0.7F);
GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
}
this.modelRenderer.postRender(0.0625F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (item == Items.SKULL)
{
float f2 = 1.1875F;
GlStateManager.scale(1.1875F, -1.1875F, -1.1875F);
if (flag)
{
GlStateManager.translate(0.0F, 0.0625F, 0.0F);
}
GameProfile gameprofile = null;
if (itemstack.hasTagCompound())
{
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
if (nbttagcompound.hasKey("SkullOwner", 10))
{
gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
}
else if (nbttagcompound.hasKey("SkullOwner", 8))
{
String s = nbttagcompound.getString("SkullOwner");
if (!StringUtils.isBlank(s))
{
gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
}
}
}
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing);
}
else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD)
{
float f3 = 0.625F;
GlStateManager.translate(0.0F, -0.25F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(0.625F, -0.625F, -0.625F);
if (flag)
{
GlStateManager.translate(0.0F, 0.1875F, 0.0F);
}
minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD);
}
GlStateManager.popMatrix();
}
}
示例12: 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);
}
}
示例13: getItemDropped
/**
* Get the Item that this Block should drop when harvested.
*/
@Nullable
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return Items.SKULL;
}
示例14: doRenderLayer
public void doRenderLayer(EntityLivingBase entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
ItemStack itemstack = entitylivingbaseIn.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
if (itemstack != null && itemstack.getItem() != null)
{
Item item = itemstack.getItem();
Minecraft minecraft = Minecraft.getMinecraft();
GlStateManager.pushMatrix();
if (entitylivingbaseIn.isSneaking())
{
GlStateManager.translate(0.0F, 0.2F, 0.0F);
}
boolean flag = entitylivingbaseIn instanceof EntityVillager || entitylivingbaseIn instanceof EntityZombie && ((EntityZombie)entitylivingbaseIn).isVillager();
if (entitylivingbaseIn.isChild() && !(entitylivingbaseIn instanceof EntityVillager))
{
float f = 2.0F;
float f1 = 1.4F;
GlStateManager.translate(0.0F, 0.5F * scale, 0.0F);
GlStateManager.scale(0.7F, 0.7F, 0.7F);
GlStateManager.translate(0.0F, 16.0F * scale, 0.0F);
}
this.modelRenderer.postRender(0.0625F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if (item == Items.SKULL)
{
float f2 = 1.1875F;
GlStateManager.scale(1.1875F, -1.1875F, -1.1875F);
if (flag)
{
GlStateManager.translate(0.0F, 0.0625F, 0.0F);
}
GameProfile gameprofile = null;
if (itemstack.hasTagCompound())
{
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
if (nbttagcompound.hasKey("SkullOwner", 10))
{
gameprofile = NBTUtil.readGameProfileFromNBT(nbttagcompound.getCompoundTag("SkullOwner"));
}
else if (nbttagcompound.hasKey("SkullOwner", 8))
{
String s = nbttagcompound.getString("SkullOwner");
if (!StringUtils.isNullOrEmpty(s))
{
gameprofile = TileEntitySkull.updateGameprofile(new GameProfile((UUID)null, s));
nbttagcompound.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), gameprofile));
}
}
}
TileEntitySkullRenderer.instance.renderSkull(-0.5F, 0.0F, -0.5F, EnumFacing.UP, 180.0F, itemstack.getMetadata(), gameprofile, -1, limbSwing);
}
else if (!(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD)
{
float f3 = 0.625F;
GlStateManager.translate(0.0F, -0.25F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.scale(0.625F, -0.625F, -0.625F);
if (flag)
{
GlStateManager.translate(0.0F, 0.1875F, 0.0F);
}
minecraft.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, ItemCameraTransforms.TransformType.HEAD);
}
GlStateManager.popMatrix();
}
}
示例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);
}
}
}