本文整理匯總了Java中net.minecraft.nbt.NBTTagList.appendTag方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTTagList.appendTag方法的具體用法?Java NBTTagList.appendTag怎麽用?Java NBTTagList.appendTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.nbt.NBTTagList
的用法示例。
在下文中一共展示了NBTTagList.appendTag方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: writeToNBT
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
compound.setShort("BurnTime", (short)this.furnaceBurnTime);
compound.setShort("CookTime", (short)this.cookTime);
compound.setShort("CookTimeTotal", (short)this.totalCookTime);
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.furnaceItemStacks.length; ++i)
{
if (this.furnaceItemStacks[i] != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setByte("Slot", (byte)i);
this.furnaceItemStacks[i].writeToNBT(nbttagcompound);
nbttaglist.appendTag(nbttagcompound);
}
}
compound.setTag("Items", nbttaglist);
if (this.hasCustomName())
{
compound.setString("CustomName", this.furnaceCustomName);
}
}
示例2: objectivesToNbt
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
protected NBTTagList objectivesToNbt()
{
NBTTagList nbttaglist = new NBTTagList();
for (ScoreObjective scoreobjective : this.theScoreboard.getScoreObjectives())
{
if (scoreobjective.getCriteria() != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setString("Name", scoreobjective.getName());
nbttagcompound.setString("CriteriaName", scoreobjective.getCriteria().getName());
nbttagcompound.setString("DisplayName", scoreobjective.getDisplayName());
nbttagcompound.setString("RenderType", scoreobjective.getRenderType().func_178796_a());
nbttaglist.appendTag(nbttagcompound);
}
}
return nbttaglist;
}
示例3: addAttributeModifier
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public void addAttributeModifier(String attributeName, AttributeModifier modifier, EntityEquipmentSlot equipmentSlot)
{
if (this.stackTagCompound == null)
{
this.stackTagCompound = new NBTTagCompound();
}
if (!this.stackTagCompound.hasKey("AttributeModifiers", 9))
{
this.stackTagCompound.setTag("AttributeModifiers", new NBTTagList());
}
NBTTagList nbttaglist = this.stackTagCompound.getTagList("AttributeModifiers", 10);
NBTTagCompound nbttagcompound = SharedMonsterAttributes.writeAttributeModifierToNBT(modifier);
nbttagcompound.setString("AttributeName", attributeName);
if (equipmentSlot != null)
{
nbttagcompound.setString("Slot", equipmentSlot.getName());
}
nbttaglist.appendTag(nbttagcompound);
}
示例4: writeToNBT
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
super.writeToNBT(compound);
NBTTagList list = new NBTTagList();
for(int i = 0; i<this.getSizeInventory(); i++){
if(this.getStackInSlot(i) != null){
NBTTagCompound stackTag = new NBTTagCompound();
stackTag.setByte("Slot", (byte) i);
getStackInSlot(i).writeToNBT(stackTag);
list.appendTag(stackTag);
}
}
compound.setTag("Items", list);
if(hasCustomName()){
compound.setString("customName", getCustomName());
}
return compound;
}
示例5: setEnchantments
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
* Set the enchantments for the specified stack.
*/
public static void setEnchantments(Map<Enchantment, Integer> enchMap, ItemStack stack)
{
NBTTagList nbttaglist = new NBTTagList();
for (Entry<Enchantment, Integer> entry : enchMap.entrySet())
{
Enchantment enchantment = (Enchantment)entry.getKey();
if (enchantment != null)
{
int i = ((Integer)entry.getValue()).intValue();
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setShort("id", (short)Enchantment.getEnchantmentID(enchantment));
nbttagcompound.setShort("lvl", (short)i);
nbttaglist.appendTag(nbttagcompound);
if (stack.getItem() == Items.ENCHANTED_BOOK)
{
Items.ENCHANTED_BOOK.addEnchantment(stack, new EnchantmentData(enchantment, i));
}
}
}
if (nbttaglist.hasNoTags())
{
if (stack.hasTagCompound())
{
stack.getTagCompound().removeTag("ench");
}
}
else if (stack.getItem() != Items.ENCHANTED_BOOK)
{
stack.setTagInfo("ench", nbttaglist);
}
}
示例6: saveInventory
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public static void saveInventory(IItemHandler inventory, NBTTagCompound tag) {
if (itemHandler != null && itemHandler.getSlots() > 0) {
NBTTagList list = new NBTTagList();
for (int i = 0; i < itemHandler.getSlots(); i++) {
ItemStack stack = itemHandler.getStackInSlot(i);
NBTTagCompound item = new NBTTagCompound();
stack.writeToNBT(item);
list.appendTag(item);
}
tag.setTag("Items", list);
}
}
示例7: writeToNBT
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
compound.setShort("BrewTime", (short)this.brewTime);
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.brewingItemStacks.length; ++i)
{
if (this.brewingItemStacks[i] != null)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setByte("Slot", (byte)i);
this.brewingItemStacks[i].writeToNBT(nbttagcompound);
nbttaglist.appendTag(nbttagcompound);
}
}
compound.setTag("Items", nbttaglist);
if (this.hasCustomName())
{
compound.setString("CustomName", this.customName);
}
compound.setByte("Fuel", (byte)this.fuel);
return compound;
}
示例8: writeToNBT
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound tagCompound)
{
super.writeToNBT(tagCompound);
NBTTagList nbttaglist = new NBTTagList();
for (ChunkPos chunkpos : this.processed)
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setInteger("X", chunkpos.chunkXPos);
nbttagcompound.setInteger("Z", chunkpos.chunkZPos);
nbttaglist.appendTag(nbttagcompound);
}
tagCompound.setTag("Processed", nbttaglist);
}
示例9: onEnable
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
@Override
public void onEnable()
{
// check gamemode
if(!WMinecraft.getPlayer().capabilities.isCreativeMode)
{
ChatUtils.error("Creative mode only.");
setEnabled(false);
return;
}
// generate potion
ItemStack stack = InventoryUtils.createSplashPotion();
NBTTagList effects = new NBTTagList();
for(int i = 1; i <= 23; i++)
{
NBTTagCompound effect = new NBTTagCompound();
effect.setInteger("Amplifier", Integer.MAX_VALUE);
effect.setInteger("Duration", Integer.MAX_VALUE);
effect.setInteger("Id", i);
effects.appendTag(effect);
}
stack.setTagInfo("CustomPotionEffects", effects);
stack.setStackDisplayName("�rSplash Potion of Trolling");
// give potion
if(InventoryUtils.placeStackInHotbar(stack))
ChatUtils.message("Potion created.");
else
ChatUtils.error("Please clear a slot in your hotbar.");
setEnabled(false);
}
示例10: writeBaseAttributeMapToNBT
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
/**
* Creates an NBTTagList from a BaseAttributeMap, including all its AttributeInstances
*/
public static NBTTagList writeBaseAttributeMapToNBT(BaseAttributeMap p_111257_0_)
{
NBTTagList nbttaglist = new NBTTagList();
for (IAttributeInstance iattributeinstance : p_111257_0_.getAllAttributes())
{
nbttaglist.appendTag(writeAttributeInstanceToNBT(iattributeinstance));
}
return nbttaglist;
}
示例11: writeInts
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
private NBTTagList writeInts(int... values)
{
NBTTagList nbttaglist = new NBTTagList();
for (int i : values)
{
nbttaglist.appendTag(new NBTTagInt(i));
}
return nbttaglist;
}
示例12: appendBrews
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public static void appendBrews(NBTTagCompound tag, Collection<BrewEffect> effects) {
NBTTagList list = new NBTTagList();
tag.setTag(BREW_DATA, list);
for (BrewEffect effect : effects) {
NBTTagCompound compound = new NBTTagCompound();
IBrew brew = effect.getBrew();
compound.setString(BREW_ID, BrewRegistry.getBrewResource(brew).toString());
compound.setInteger(BREW_AMPLIFIER, effect.getAmplifier());
compound.setInteger(BREW_DURATION, effect.getDuration());
list.appendTag(compound);
}
}
示例13: getSaveData
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public static NBTTagCompound getSaveData(ModelObj model)
{
NBTTagCompound parentNBT = new NBTTagCompound();
NBTTagList parentNBTList = new NBTTagList();
for (PartObj part : model.getPartObjs())
{
Set<PartObj> children = part.getChildren();
List<PartObj> mergeParts = part.getMergedParts();
if (!children.isEmpty() || !mergeParts.isEmpty())
{
NBTTagCompound parentCompound = new NBTTagCompound();
parentCompound.setString("Parent", part.getName());
int i = 0;
for (PartObj child : children)
{
String name = child.getName();
if (child.hasBend())
{
name += "*";
}
parentCompound.setString("Child" + i, name);
i++;
}
for(int j = 0; j < mergeParts.size(); j++)
{
PartObj mergedPart = mergeParts.get(j);
parentCompound.setString("Merged" + j, mergedPart.getName());
}
parentNBTList.appendTag(parentCompound);
}
}
parentNBT.setTag("Parenting", parentNBTList);
return parentNBT;
}
示例14: getRecipiesAsTags
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public NBTTagCompound getRecipiesAsTags()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.size(); ++i)
{
MerchantRecipe merchantrecipe = (MerchantRecipe)this.get(i);
nbttaglist.appendTag(merchantrecipe.writeToTags());
}
nbttagcompound.setTag("Recipes", nbttaglist);
return nbttagcompound;
}
示例15: writeToNBT
import net.minecraft.nbt.NBTTagList; //導入方法依賴的package包/類
public void writeToNBT(NBTTagCompound nbt)
{
String s = this.getEntityNameToSpawn();
if (!StringUtils.isNullOrEmpty(s))
{
nbt.setString("EntityId", s);
nbt.setShort("Delay", (short)this.spawnDelay);
nbt.setShort("MinSpawnDelay", (short)this.minSpawnDelay);
nbt.setShort("MaxSpawnDelay", (short)this.maxSpawnDelay);
nbt.setShort("SpawnCount", (short)this.spawnCount);
nbt.setShort("MaxNearbyEntities", (short)this.maxNearbyEntities);
nbt.setShort("RequiredPlayerRange", (short)this.activatingRangeFromPlayer);
nbt.setShort("SpawnRange", (short)this.spawnRange);
if (this.getRandomEntity() != null)
{
nbt.setTag("SpawnData", this.getRandomEntity().nbtData.copy());
}
if (this.getRandomEntity() != null || this.minecartToSpawn.size() > 0)
{
NBTTagList nbttaglist = new NBTTagList();
if (this.minecartToSpawn.size() > 0)
{
for (MobSpawnerBaseLogic.WeightedRandomMinecart mobspawnerbaselogic$weightedrandomminecart : this.minecartToSpawn)
{
nbttaglist.appendTag(mobspawnerbaselogic$weightedrandomminecart.toNBT());
}
}
else
{
nbttaglist.appendTag(this.getRandomEntity().toNBT());
}
nbt.setTag("SpawnPotentials", nbttaglist);
}
}
}