本文整理匯總了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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例13: gameProfileToNBT
import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public CompoundTag gameProfileToNBT(GameProfile profile) {
return (CompoundTag) NBTUtil.writeGameProfile(new NBTTagCompound(), profile);
}