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


Java NBTTagCompound.setTag方法代碼示例

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


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

示例1: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
	super.writeToNBT(compound);
	compound.setTag("items", inventory.saveToNbt());

	if (inventory.hasCustomName()) {
		compound.setString("CustomName", this.customName);
	}

	compound.setInteger("WorkTime", (short) this.workTime);
	compound.setInteger("totalWorkTime", (short) this.totalWorkTime);
	compound.setInteger("BurnTime", (short) this.burnTime);
	compound.setInteger("itemBurnTime", (short) this.itemBurnTime);
	compound.setBoolean("isBurning", this.isBurning);
	return compound;
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:17,代碼來源:TileOven.java

示例2: saveChunk

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void saveChunk(World worldIn, Chunk chunkIn) throws MinecraftException, IOException
{
    worldIn.checkSessionLock();

    try
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound.setTag("Level", nbttagcompound1);
        this.writeChunkToNBT(chunkIn, worldIn, nbttagcompound1);
        this.addChunkToPending(chunkIn.getChunkCoordIntPair(), nbttagcompound);
    }
    catch (Exception exception)
    {
        logger.error((String)"Failed to save chunk", (Throwable)exception);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:AnvilChunkLoader.java

示例3: writeToTags

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToTags()
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    nbttagcompound.setTag("buy", this.itemToBuy.writeToNBT(new NBTTagCompound()));
    nbttagcompound.setTag("sell", this.itemToSell.writeToNBT(new NBTTagCompound()));

    if (this.secondItemToBuy != null)
    {
        nbttagcompound.setTag("buyB", this.secondItemToBuy.writeToNBT(new NBTTagCompound()));
    }

    nbttagcompound.setInteger("uses", this.toolUses);
    nbttagcompound.setInteger("maxUses", this.maxTradeUses);
    nbttagcompound.setBoolean("rewardExp", this.rewardsExp);
    return nbttagcompound;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:MerchantRecipe.java

示例4: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setInteger("Base", this.baseColor.getDyeDamage());

    if (this.patterns != null)
    {
        compound.setTag("Patterns", this.patterns);
    }

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.field_190617_a);
    }

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

示例5: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void writeToNBT(NBTTagCompound tag) {
    NBTTagCompound pneumaticTag = new NBTTagCompound();
    pneumaticTag.setInteger("air", air);
    pneumaticTag.setInteger("volume", volume);
    pneumaticTag.setFloat("maxPressure", maxPressure);
    tag.setTag("pneumatic", pneumaticTag);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:9,代碼來源:AirHandler.java

示例6: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound) {
    super.writeToNBT(nbtTagCompound);
    nbtTagCompound.setInteger("burnTime", burnTime);
    nbtTagCompound.setInteger("maxBurn", maxBurnTime);
    nbtTagCompound.setInteger("redstoneMode", redstoneMode);
    nbtTagCompound.setTag("Items", inventory.serializeNBT());
    return nbtTagCompound;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:10,代碼來源:TileEntityAirCompressor.java

示例7: writeEntityToNBT

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

    if (this.lootTable != null)
    {
        compound.setString("LootTable", this.lootTable.toString());

        if (this.lootTableSeed != 0L)
        {
            compound.setLong("LootTableSeed", this.lootTableSeed);
        }
    }
    else
    {
        NBTTagList nbttaglist = new NBTTagList();

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

        compound.setTag("Items", nbttaglist);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:35,代碼來源:EntityMinecartContainer.java

示例8: readPoseFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
private NBTTagCompound readPoseFromNBT()
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();

    if (!DEFAULT_HEAD_ROTATION.equals(this.headRotation))
    {
        nbttagcompound.setTag("Head", this.headRotation.writeToNBT());
    }

    if (!DEFAULT_BODY_ROTATION.equals(this.bodyRotation))
    {
        nbttagcompound.setTag("Body", this.bodyRotation.writeToNBT());
    }

    if (!DEFAULT_LEFTARM_ROTATION.equals(this.leftArmRotation))
    {
        nbttagcompound.setTag("LeftArm", this.leftArmRotation.writeToNBT());
    }

    if (!DEFAULT_RIGHTARM_ROTATION.equals(this.rightArmRotation))
    {
        nbttagcompound.setTag("RightArm", this.rightArmRotation.writeToNBT());
    }

    if (!DEFAULT_LEFTLEG_ROTATION.equals(this.leftLegRotation))
    {
        nbttagcompound.setTag("LeftLeg", this.leftLegRotation.writeToNBT());
    }

    if (!DEFAULT_RIGHTLEG_ROTATION.equals(this.rightLegRotation))
    {
        nbttagcompound.setTag("RightLeg", this.rightLegRotation.writeToNBT());
    }

    return nbttagcompound;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:37,代碼來源:EntityArmorStand.java

示例9: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    if ("EntityHorse".equals(compound.getString("id")) && !compound.hasKey("SaddleItem", 10) && compound.getBoolean("Saddle"))
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        nbttagcompound.setString("id", "minecraft:saddle");
        nbttagcompound.setByte("Count", (byte)1);
        nbttagcompound.setShort("Damage", (short)0);
        compound.setTag("SaddleItem", nbttagcompound);
        compound.removeTag("Saddle");
    }

    return compound;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:15,代碼來源:HorseSaddle.java

示例10: actionPerformed

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void actionPerformed(GuiButton button) {
    if (button.id == 0) {
        invSearchGui = new GuiInventorySearcher(FMLClientHandler.instance().getClient().player);
        FMLClientHandler.instance().showGuiScreen(invSearchGui);
    } else if (button.id == 1) {
        NBTTagCompound mainTag = new NBTTagCompound();
        mainTag.setTag("main", remote.getTagCompound() != null ? remote.getTagCompound().getTagList("actionWidgets", 10) : new NBTTagCompound());
        FMLClientHandler.instance().showGuiScreen(pastebinGui = new GuiPastebin(this, mainTag));
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:12,代碼來源:GuiRemoteEditor.java

示例11: writeToNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
    NBTTagList list = new NBTTagList();
    for (Map.Entry<Integer, DimensionData> entry : dimensionDataMap.entrySet()) {
        int dimensionId = entry.getKey();
        DimensionData data = entry.getValue();
        NBTTagCompound tag = new NBTTagCompound();
        tag.setInteger("dimension", dimensionId);
        data.writeToNBT(tag);
        list.appendTag(tag);
    }
    compound.setTag("dimlist", list);
    return compound;
}
 
開發者ID:McJty,項目名稱:needtobreath,代碼行數:15,代碼來源:CleanAirManager.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)
{
    super.writeEntityToNBT(compound);
    compound.setInteger("Profession", this.getProfession());
    compound.setString("ProfessionName", this.getProfessionForge().getRegistryName().toString());
    compound.setInteger("Riches", this.wealth);
    compound.setInteger("Career", this.careerId);
    compound.setInteger("CareerLevel", this.careerLevel);
    compound.setBoolean("Willing", this.isWillingToMate);

    if (this.buyingList != null)
    {
        compound.setTag("Offers", this.buyingList.getRecipiesAsTags());
    }

    NBTTagList nbttaglist = new NBTTagList();

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

        if (itemstack != null)
        {
            nbttaglist.appendTag(itemstack.writeToNBT(new NBTTagCompound()));
        }
    }

    compound.setTag("Inventory", nbttaglist);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:33,代碼來源:EntityVillager.java

示例13: writeToNBT

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

    if (!this.checkLootAndWrite(compound))
    {
        NBTTagList nbttaglist = new NBTTagList();

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

        compound.setTag("Items", nbttaglist);
    }

    compound.setInteger("TransferCooldown", this.transferCooldown);

    if (this.hasCustomName())
    {
        compound.setString("CustomName", this.customName);
    }

    return compound;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:32,代碼來源:TileEntityHopper.java

示例14: applyEntityIdToItemStack

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * APplies the given entity ID to the given ItemStack's NBT data.
 */
public static void applyEntityIdToItemStack(ItemStack stack, ResourceLocation entityId)
{
    NBTTagCompound nbttagcompound = stack.hasTagCompound() ? stack.getTagCompound() : new NBTTagCompound();
    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
    nbttagcompound1.setString("id", entityId.toString());
    nbttagcompound.setTag("EntityTag", nbttagcompound1);
    stack.setTagCompound(nbttagcompound);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:12,代碼來源:ItemMonsterPlacer.java

示例15: onItemUse

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    ItemStack iStack = player.getHeldItem(hand);
    if (!world.isRemote) {
        EntityDrone drone = new EntityLogisticsDrone(world, player);

        BlockPos placePos = pos.offset(facing);
        drone.setPosition(placePos.getX() + 0.5, placePos.getY() + 0.5, placePos.getZ() + 0.5);
        world.spawnEntity(drone);

        NBTTagCompound stackTag = iStack.getTagCompound();
        NBTTagCompound entityTag = new NBTTagCompound();
        drone.writeEntityToNBT(entityTag);
        if (stackTag != null) {
            entityTag.setFloat("currentAir", stackTag.getFloat("currentAir"));
            entityTag.setInteger("color", stackTag.getInteger("color"));
            entityTag.setTag(ChargeableItemHandler.NBT_UPGRADE_TAG, stackTag.getCompoundTag(ChargeableItemHandler.NBT_UPGRADE_TAG));
        }
        drone.readEntityFromNBT(entityTag);
        addLogisticsProgram(pos, drone.progWidgets);
        if (iStack.hasDisplayName()) drone.setCustomNameTag(iStack.getDisplayName());

        drone.naturallySpawned = false;
        //TODO 1.8 check if valid replacement drone.onSpawnWithEgg(null);
        drone.onInitialSpawn(world.getDifficultyForLocation(placePos), null);
        iStack.shrink(1);
    }
    return EnumActionResult.SUCCESS;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:30,代碼來源:ItemLogisticsDrone.java


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