本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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());
}
示例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;
}
示例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);
}
示例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;
}