本文整理匯總了Java中net.minecraft.nbt.NBTUtil.func_152460_a方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTUtil.func_152460_a方法的具體用法?Java NBTUtil.func_152460_a怎麽用?Java NBTUtil.func_152460_a使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.nbt.NBTUtil
的用法示例。
在下文中一共展示了NBTUtil.func_152460_a方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getDrops
import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public ArrayList<ItemStack> getDrops(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, int p_149749_6_, int fortune)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
{
if ((p_149749_6_ & 8) == 0)
{
ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_));
TileEntitySkull tileentityskull = (TileEntitySkull)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
if (tileentityskull == null) return ret;
if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null)
{
itemstack.setTagCompound(new NBTTagCompound());
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTUtil.func_152460_a(nbttagcompound, tileentityskull.func_152108_a());
itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
ret.add(itemstack);
}
}
return ret;
}
示例2: getDrops
import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public Collection<ItemStack> getDrops() {
List<ItemStack> drops = new ArrayList<ItemStack>();
net.minecraft.block.Block block = this.getNMSBlock();
if (block != Blocks.air) {
byte data = getData();
// based on nms.Block.dropNaturally
int count = block.quantityDroppedWithBonus(0, chunk.getHandle().worldObj.rand);
for (int i = 0; i < count; ++i) {
Item item = block.getItemDropped(data, chunk.getHandle().worldObj.rand, 0);
if (item != null) {
// Skulls are special, their data is based on the tile entity
if (Blocks.skull == block) {
net.minecraft.item.ItemStack nmsStack = new net.minecraft.item.ItemStack(item, 1, block.getDamageValue(chunk.getHandle().worldObj, x, y, z));
TileEntitySkull tileentityskull = (TileEntitySkull) chunk.getHandle().worldObj.getTileEntity(x, y, z);
if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_152108_a() != null) {
nmsStack.setTagCompound(new NBTTagCompound());
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTUtil.func_152460_a(nbttagcompound, tileentityskull.func_152108_a());
nmsStack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
drops.add(CraftItemStack.asBukkitCopy(nmsStack));
// We don't want to drop cocoa blocks, we want to drop cocoa beans.
} else if (Blocks.cocoa == block) {
int dropAmount = (BlockCocoa.func_149987_c(data) >= 2 ? 3 : 1);
for (int j = 0; j < dropAmount; ++j) {
drops.add(new ItemStack(Material.INK_SACK, 1, (short) 3));
}
} else {
drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1, (short) block.damageDropped(data)));
}
}
}
}
return drops;
}
示例3: applyToItem
import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
void applyToItem(net.minecraft.nbt.NBTTagCompound tag) {
super.applyToItem(tag);
if (hasOwner()) {
NBTTagCompound owner = new NBTTagCompound();
NBTUtil.func_152460_a(owner, profile);
tag.setTag(SKULL_OWNER.NBT, owner);
}
}
示例4: getHead
import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
private ItemStack getHead(GameProfile owner) {
ItemStack itemStack = new ItemStack(Items.skull, 1, 3);
if (owner != null) {
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound gameProfileTag = new NBTTagCompound();
NBTUtil.func_152460_a(gameProfileTag, refreshGameProfile(owner));
tag.setTag("SkullOwner", gameProfileTag);
itemStack.setTagCompound(tag);
}
return itemStack;
}
示例5: writeToNBT
import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound p_145841_1_)
{
super.writeToNBT(p_145841_1_);
p_145841_1_.setByte("SkullType", (byte)(this.field_145908_a & 255));
p_145841_1_.setByte("Rot", (byte)(this.field_145910_i & 255));
if (this.field_152110_j != null)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
NBTUtil.func_152460_a(nbttagcompound1, this.field_152110_j);
p_145841_1_.setTag("Owner", nbttagcompound1);
}
}
示例6: processPacket
import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
void processPacket(PacketBuffer buffer) throws IOException {
readBuffer(buffer);
if (nbt.hasKey("ExtraType") && !StringUtils.isNullOrEmpty(nbt.getString("ExtraType"))) {
String name = nbt.getString("ExtraType");
NBTTagCompound profile = new NBTTagCompound();
NBTUtil.func_152460_a(new NBTTagCompound(), new GameProfile(null, name));
nbt.setTag("Owner", profile);
}
buffer.clear();
buffer.writeVarIntToBuffer(0x35);
writeBuffer(buffer);
}
示例7: onItemRightClick
import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (Config.enablePlayerInterface)
{
NBTTagCompound compound = stack.getTagCompound();
if (!player.isSneaking())
{
if (!world.isRemote)
{
if (NBTHelper.getTag(stack, "profile") == null)
{
NBTTagCompound nbt = new NBTTagCompound();
NBTUtil.func_152460_a(nbt, player.getGameProfile());
NBTHelper.setTag(stack, "profile", nbt);
NBTHelper.setBoolean(stack, "getStacks", false);
NBTHelper.setBoolean(stack, "withdraw", false);
NBTHelper.setBoolean(stack, "deposit", false);
player.addChatComponentMessage(new ChatComponentTranslation("peripheralsplusplus.chat.permCard.set"));
}
else
{
player.addChatComponentMessage(new ChatComponentTranslation("peripheralsplusplus.chat.permCard.alreadySet"));
}
}
}
else
{
if (compound == null || NBTHelper.getTag(stack, "profile") == null)
{
if (!world.isRemote)
{
player.addChatComponentMessage(new ChatComponentTranslation("peripheralsplusplus.chat.permCard.notSet"));
}
return stack;
}
if (!NBTUtil.func_152459_a(NBTHelper.getCompoundTag(stack, "profile")).getId().toString().equals(player.getGameProfile().getId().toString()))
{
if (!world.isRemote)
{
player.addChatComponentMessage(new ChatComponentTranslation("peripheralsplusplus.chat.permCard.wrongOwner"));
}
return stack;
}
player.openGui(PeripheralsPlusPlus.instance, Reference.GUIs.PERMCARD.ordinal(), world, (int) player.posX, (int) player.posY, (int) player.posZ);
}
}
return stack;
}
示例8: writeToNBT
import net.minecraft.nbt.NBTUtil; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound nbtTag)
{
super.writeToNBT(nbtTag);
NBTUtil.func_152460_a(nbtTag, this.owner);
}