當前位置: 首頁>>代碼示例>>Java>>正文


Java NBTUtil.writeGameProfile方法代碼示例

本文整理匯總了Java中net.minecraft.nbt.NBTUtil.writeGameProfile方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTUtil.writeGameProfile方法的具體用法?Java NBTUtil.writeGameProfile怎麽用?Java NBTUtil.writeGameProfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.nbt.NBTUtil的用法示例。


在下文中一共展示了NBTUtil.writeGameProfile方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeToNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag)
{
    super.writeToNBT(tag);
    tag.setBoolean("hasBase", hasBase);
    tag.setInteger("head", head);
    tag.setBoolean("hasStand", hasStand);
    tag.setBoolean("isOnFloor", isOnFloor);
    tag.setInteger("orientation", orientation);
    tag.setInteger("sideOn", sideOn);

    tag.setString("hatName", hatName);
    tag.setInteger("colourR", colourR);
    tag.setInteger("colourG", colourG);
    tag.setInteger("colourB", colourB);
    tag.setInteger("alpha", alpha);

    if (this.gameProfile != null)
    {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        NBTUtil.writeGameProfile(nbttagcompound1, this.gameProfile);
        tag.setTag("headNameProfile", nbttagcompound1);
    }
    return tag;
}
 
開發者ID:iChun,項目名稱:Hats,代碼行數:26,代碼來源:TileEntityHatStand.java

示例2: breakBlock

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        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, this.getDamageValue(worldIn, pos));

                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);
                }

                spawnAsEntity(worldIn, pos, itemstack);
            }
        }

        super.breakBlock(worldIn, pos, state);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:29,代碼來源:BlockSkull.java

示例3: writeToNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setByte("SkullType", (byte)(this.skullType & 255));
    compound.setByte("Rot", (byte)(this.skullRotation & 255));

    if (this.playerProfile != null)
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTUtil.writeGameProfile(nbttagcompound, this.playerProfile);
        compound.setTag("Owner", nbttagcompound);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:14,代碼來源:TileEntitySkull.java

示例4: breakBlock

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
/**
 * Called serverside after this block is replaced with another in Chunk, but before the Tile Entity is updated
 */
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        if (!((Boolean)state.getValue(NODROP)).booleanValue())
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntitySkull)
            {
                TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
                ItemStack itemstack = this.getItem(worldIn, pos, state);

                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);
                }

                spawnAsEntity(worldIn, pos, itemstack);
            }
        }

        super.breakBlock(worldIn, pos, state);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:32,代碼來源:BlockSkull.java

示例5: writeToNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setByte("SkullType", (byte)(this.skullType & 255));
    compound.setByte("Rot", (byte)(this.skullRotation & 255));

    if (this.playerProfile != null)
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTUtil.writeGameProfile(nbttagcompound, this.playerProfile);
        compound.setTag("Owner", nbttagcompound);
    }

    return compound;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:16,代碼來源:TileEntitySkull.java

示例6: getDrops

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
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;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:28,代碼來源:BlockSkull.java

示例7: createPlayerHead

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public static ItemStack createPlayerHead(EntityPlayer player){
  ItemStack skull = new ItemStack(Items.SKULL, 1, 3);
  if(player == null || player instanceof FakePlayer)return skull;
    skull.setTagCompound(new NBTTagCompound());
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    NBTUtil.writeGameProfile(nbttagcompound, player.getGameProfile());
    skull.getTagCompound().setTag("SkullOwner", nbttagcompound);
    return skull;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:10,代碼來源:PlayerUtil.java

示例8: toNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public void toNBT(NBTTagCompound tag)
{
    super.toNBT(tag);

    if (this.profile != null)
    {
        NBTTagCompound profileTag = new NBTTagCompound();

        NBTUtil.writeGameProfile(profileTag, this.profile);
        tag.setTag("PlayerProfile", profileTag);
    }
}
 
開發者ID:mchorse,項目名稱:metamorph,代碼行數:14,代碼來源:PlayerMorph.java

示例9: writeToNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public void writeToNBT(final NBTTagCompound tag) {
	super.writeToNBT(tag);

	final NBTTagCompound inventoriesTag = new NBTTagCompound();
	final NBTTagCompound ownerTag = new NBTTagCompound();

	for (final Entry<String, Map<Integer, ItemStack>> inventoryEntry : this.inventories.entrySet()) {
		final NBTTagList inventoryTag = new NBTTagList();

		for (final Entry<Integer, ItemStack> slotEntry : inventoryEntry.getValue().entrySet()) {
			final NBTTagCompound slotTag = new NBTTagCompound();

			slotEntry.getValue().writeToNBT(slotTag);
			slotTag.setByte("slot", slotEntry.getKey().byteValue());

			inventoryTag.appendTag(slotTag);
		}

		inventoriesTag.setTag(inventoryEntry.getKey(), inventoryTag);
	}

	NBTUtil.writeGameProfile(ownerTag, this.owner);

	tag.setLong("age", this.age);
	tag.setTag("inventories", inventoriesTag);
	tag.setTag("owner", ownerTag);
}
 
開發者ID:benblank,項目名稱:Ice,代碼行數:29,代碼來源:DeathMarkerTileEntity.java

示例10: getSkullFromOwner

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
/**
 * The utility method to get the skull item stack from the player's name.
 *
 * @param owner The skull owner
 * @return The stack of skull with one item inside
 */
public static ItemStack getSkullFromOwner(GameProfile owner) {
    ItemStack skull = new ItemStack(Items.SKULL, 1, 3);

    NBTTagCompound tag = skull.getOrCreateSubCompound("SkullOwner");
    NBTUtil.writeGameProfile(tag, owner);

    return skull;
}
 
開發者ID:liachmodded,項目名稱:UHC-Reloaded,代碼行數:15,代碼來源:Misc.java

示例11: writeEntityToNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public void writeEntityToNBT(NBTTagCompound tag) {
	super.writeEntityToNBT(tag);

	if (owner != null) {
		NBTTagCompound ownerTag = new NBTTagCompound();
		NBTUtil.writeGameProfile(ownerTag, owner);
		tag.setTag("Owner", ownerTag);
	}

	tag.setInteger("pickupCooldown", pickupCooldown);
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:13,代碼來源:EntityMiniMe.java

示例12: writeToNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
	nbt = super.writeToNBT(nbt);

	if (owner != null) {
		NBTTagCompound ownerTag = new NBTTagCompound();
		NBTUtil.writeGameProfile(ownerTag, owner);
		nbt.setTag("Owner", ownerTag);
	}

	return nbt;
}
 
開發者ID:OpenMods,項目名稱:OpenBlocks,代碼行數:13,代碼來源:TileEntityGoldenEgg.java

示例13: gameProfileToNBT

import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public CompoundTag gameProfileToNBT(GameProfile profile) {
    return (CompoundTag) NBTUtil.writeGameProfile(new NBTTagCompound(), profile);
}
 
開發者ID:NeptunePowered,項目名稱:NeptuneCommon,代碼行數:5,代碼來源:NeptuneJsonNBTUtility.java


注:本文中的net.minecraft.nbt.NBTUtil.writeGameProfile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。