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


Java NBTTagCompound.setByte方法代碼示例

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


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

示例1: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    super.writeEntityToNBT(compound);
    compound.setBoolean("ChestedHorse", this.func_190695_dh());

    if (this.func_190695_dh())
    {
        NBTTagList nbttaglist = new NBTTagList();

        for (int i = 2; i < this.horseChest.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.horseChest.getStackInSlot(i);

            if (!itemstack.func_190926_b())
            {
                NBTTagCompound nbttagcompound = new NBTTagCompound();
                nbttagcompound.setByte("Slot", (byte)i);
                itemstack.writeToNBT(nbttagcompound);
                nbttaglist.appendTag(nbttagcompound);
            }
        }

        compound.setTag("Items", nbttaglist);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:29,代碼來源:AbstractChestHorse.java

示例2: writeNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeNBT(NBTTagCompound compound) {
    compound.setTag("Pos", NBTUtil.createPosTag(pos));
    compound.setInteger("SyncType", type.ordinal());
    compound.setInteger("Length", values.length);
    ByteBuf buf = Unpooled.buffer();
    NBTTagList list = new NBTTagList();
    for (int i = 0; i < types.length; i++) {
        NBTTagCompound element = new NBTTagCompound();
        element.setByte("Type", types[i]);
        buf.clear();
        PacketUpdateGui.writeField(buf, values[i], types[i]);
        element.setByteArray("Value", Arrays.copyOf(buf.array(), buf.writerIndex()));
        list.appendTag(element);
    }
    buf.release();
    compound.setTag("Data", list);
    compound.setTag("Extra", extraData);

    return compound;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:21,代碼來源:PacketDescription.java

示例3: spawnFirework

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static void spawnFirework(World world, double x, double y, double z) {
    ItemStack rocket = new ItemStack(Items.FIREWORKS);

    ItemStack itemstack1 = getFireworkCharge();

    NBTTagCompound nbttagcompound = new NBTTagCompound();
    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
    NBTTagList nbttaglist = new NBTTagList();

    if (itemstack1 != null && itemstack1.getItem() == Items.FIREWORK_CHARGE && itemstack1.hasTagCompound() && itemstack1.getTagCompound().hasKey("Explosion")) {
        nbttaglist.appendTag(itemstack1.getTagCompound().getCompoundTag("Explosion"));
    }

    nbttagcompound1.setTag("Explosions", nbttaglist);
    nbttagcompound1.setByte("Flight", (byte) 2);
    nbttagcompound.setTag("Fireworks", nbttagcompound1);

    rocket.setTagCompound(nbttagcompound);

    EntityFireworkRocket entity = new EntityFireworkRocket(world, x, y, z, rocket);
    world.spawnEntity(entity);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:23,代碼來源:DateEventHandler.java

示例4: getStackWithInventory

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static ItemStack getStackWithInventory(IInventory inventory, IBlockState state) {
	if (inventory != null && inventory.getSizeInventory() > 0 && state != null) {
		ItemStack stack = new ItemStack(Item.getItemFromBlock(state.getBlock()));
		NBTTagCompound stackNBT = new NBTTagCompound();//stack.getSubCompound("BlockEntityTag", true);
		NBTTagList stackList = new NBTTagList();
		for (int i = 0; i < inventory.getSizeInventory(); i++) {
			if (inventory.getStackInSlot(i) == null) {
				continue;
			}
			NBTTagCompound slotNBT = new NBTTagCompound();
			slotNBT.setByte("Slot", (byte) i);
			inventory.getStackInSlot(i).writeToNBT(slotNBT);
			stackList.appendTag(slotNBT);
		}
		stackNBT.setTag("Items", stackList);
		stack.setTagInfo("BlockEntityTag", stackNBT);
		return stack;
	}
	return null;
}
 
開發者ID:p455w0rd,項目名稱:EndermanEvolution,代碼行數:21,代碼來源:ChestUtils.java

示例5: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
    tagCompound.setShort("xTile", (short)this.xTile);
    tagCompound.setShort("yTile", (short)this.yTile);
    tagCompound.setShort("zTile", (short)this.zTile);
    ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile);
    tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
    tagCompound.setByte("shake", (byte)this.throwableShake);
    tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));

    if ((this.throwerName == null || this.throwerName.length() == 0) && this.thrower instanceof EntityPlayer)
    {
        this.throwerName = this.thrower.getName();
    }

    tagCompound.setString("ownerName", this.throwerName == null ? "" : this.throwerName);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:21,代碼來源:EntityThrowable.java

示例6: serializeNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public NBTTagCompound serializeNBT()
{
	NBTTagCompound ret = new NBTTagCompound();
	NBTTagList lst = new NBTTagList();
	for (Entry<EnumPlantNutrient, Float> e : this.nutrientData.entrySet())
	{
		NBTTagCompound nbt = new NBTTagCompound();
		nbt.setByte("key", (byte) e.getKey().ordinal());
		nbt.setFloat("value", e.getValue());
		lst.appendTag(nbt);
	}
	
	ret.setTag("nutrientData", lst);
	ret.setFloat("moisture", this.moistureLevel);
	ret.setTag("calendar", this.timeKeeper.serializeNBT());
	return ret;
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:19,代碼來源:ExPFarmland.java

示例7: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    NBTTagList nbttaglist = new NBTTagList();

    for (int i = 0; i < this.stacks.length; ++i)
    {
        if (this.stacks[i] != null)
        {
            NBTTagCompound nbttagcompound = new NBTTagCompound();
            nbttagcompound.setByte("Slot", (byte)i);
            this.stacks[i].writeToNBT(nbttagcompound);
            nbttaglist.appendTag(nbttagcompound);
        }
    }

    compound.setTag("Items", nbttaglist);

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.customName);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:24,代碼來源:TileEntityDispenser.java

示例8: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
    compound.setInteger("timeout", timeout);
    compound.setByte("portalSide", (byte) portalSide.ordinal());
    compound.setLong("pos", other.getPos().toLong());
    compound.setInteger("dim", other.getDimension());
    compound.setByte("side", (byte) other.getSide().ordinal());
    NBTTagList list = new NBTTagList();
    for (UUID uuid : blackListed) {
        NBTTagCompound tc = new NBTTagCompound();
        tc.setLong("m", uuid.getMostSignificantBits());
        tc.setLong("l", uuid.getLeastSignificantBits());
        list.appendTag(tc);
    }
    compound.setTag("bl", list);
    return super.writeToNBT(compound);
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:18,代碼來源:PortalTileEntity.java

示例9: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
protected void writeEntityToNBT(NBTTagCompound tagCompound)
{
    Block block = this.fallTile != null ? this.fallTile.getBlock() : Blocks.air;
    ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(block);
    tagCompound.setString("Block", resourcelocation == null ? "" : resourcelocation.toString());
    tagCompound.setByte("Data", (byte)block.getMetaFromState(this.fallTile));
    tagCompound.setByte("Time", (byte)this.fallTime);
    tagCompound.setBoolean("DropItem", this.shouldDropItem);
    tagCompound.setBoolean("HurtEntities", this.hurtEntities);
    tagCompound.setFloat("FallHurtAmount", this.fallHurtAmount);
    tagCompound.setInteger("FallHurtMax", this.fallHurtMax);

    if (this.tileEntityData != null)
    {
        tagCompound.setTag("TileEntityData", this.tileEntityData);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:EntityFallingBlock.java

示例10: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
    compound.setByte("dimension", this.dimension);
    compound.setInteger("xCenter", this.xCenter);
    compound.setInteger("zCenter", this.zCenter);
    compound.setByte("scale", this.scale);
    compound.setShort("width", (short)128);
    compound.setShort("height", (short)128);
    compound.setByteArray("colors", this.colors);
    compound.setBoolean("trackingPosition", this.trackingPosition);
    compound.setBoolean("unlimitedTracking", this.field_191096_f);
    return compound;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:14,代碼來源:MapData.java

示例11: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    compound.setInteger("xTile", this.xTile);
    compound.setInteger("yTile", this.yTile);
    compound.setInteger("zTile", this.zTile);
    compound.setShort("life", (short)this.ticksInGround);
    ResourceLocation resourcelocation = (ResourceLocation)Block.REGISTRY.getNameForObject(this.inTile);
    compound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
    compound.setByte("inData", (byte)this.inData);
    compound.setByte("shake", (byte)this.arrowShake);
    compound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
    compound.setByte("pickup", (byte)this.pickupStatus.ordinal());
    compound.setDouble("damage", this.damage);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:EntityArrow.java

示例12: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound compound)
{
    compound.setByte("Facing", (byte)this.facingDirection.getHorizontalIndex());
    BlockPos blockpos = this.getHangingPosition();
    compound.setInteger("TileX", blockpos.getX());
    compound.setInteger("TileY", blockpos.getY());
    compound.setInteger("TileZ", blockpos.getZ());
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:12,代碼來源:EntityHanging.java

示例13: writeCustomPotionEffectToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Write a custom potion effect to a potion item's NBT data.
 */
public NBTTagCompound writeCustomPotionEffectToNBT(NBTTagCompound nbt)
{
    nbt.setByte("Id", (byte)Potion.getIdFromPotion(this.getPotion()));
    nbt.setByte("Amplifier", (byte)this.getAmplifier());
    nbt.setInteger("Duration", this.getDuration());
    nbt.setBoolean("Ambient", this.getIsAmbient());
    nbt.setBoolean("ShowParticles", this.doesShowParticles());
    return nbt;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:PotionEffect.java

示例14: writeEntityToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
    if (this.getDisplayedItem() != null)
    {
        tagCompound.setTag("Item", this.getDisplayedItem().writeToNBT(new NBTTagCompound()));
        tagCompound.setByte("ItemRotation", (byte)this.getRotation());
        tagCompound.setFloat("ItemDropChance", this.itemDropChance);
    }

    super.writeEntityToNBT(tagCompound);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:15,代碼來源:EntityItemFrame.java

示例15: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Write the stack fields to a NBT object. Return the new NBT object.
 */
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
{
    ResourceLocation resourcelocation = (ResourceLocation)Item.REGISTRY.getNameForObject(this.item);
    nbt.setString("id", resourcelocation == null ? "minecraft:air" : resourcelocation.toString());
    nbt.setByte("Count", (byte)this.stackSize);
    nbt.setShort("Damage", (short)this.itemDamage);

    if (this.stackTagCompound != null)
    {
        nbt.setTag("tag", this.stackTagCompound);
    }

    return nbt;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:18,代碼來源:ItemStack.java


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