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


Java NBTTagCompound.getCompoundTag方法代碼示例

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


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

示例1: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound compound)
{
    this.fireworkAge = compound.getInteger("Life");
    this.lifetime = compound.getInteger("LifeTime");
    NBTTagCompound nbttagcompound = compound.getCompoundTag("FireworksItem");

    if (nbttagcompound != null)
    {
        ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);

        if (itemstack != null)
        {
            this.dataManager.set(FIREWORK_ITEM, Optional.of(itemstack));
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:EntityFireworkRocket.java

示例2: fixTagCompound

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public NBTTagCompound fixTagCompound(NBTTagCompound compound)
{
    String s = compound.getString("id");

    if ("minecraft:potion".equals(s) || "minecraft:splash_potion".equals(s) || "minecraft:lingering_potion".equals(s) || "minecraft:tipped_arrow".equals(s))
    {
        NBTTagCompound nbttagcompound = compound.getCompoundTag("tag");

        if (!nbttagcompound.hasKey("Potion", 8))
        {
            nbttagcompound.setString("Potion", "minecraft:water");
        }

        if (!compound.hasKey("tag", 10))
        {
            compound.setTag("tag", nbttagcompound);
        }
    }

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

示例3: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound compound)
{
    super.readEntityFromNBT(compound);
    this.setHorseVariant(compound.getInteger("Variant"));

    if (compound.hasKey("ArmorItem", 10))
    {
        ItemStack itemstack = new ItemStack(compound.getCompoundTag("ArmorItem"));

        if (!itemstack.func_190926_b() && HorseArmorType.isHorseArmor(itemstack.getItem()))
        {
            this.horseChest.setInventorySlotContents(1, itemstack);
        }
    }

    this.updateHorseSlots();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:21,代碼來源:EntityHorse.java

示例4: ItemStack

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public ItemStack(NBTTagCompound p_i47263_1_)
{
    this.item = Item.getByNameOrId(p_i47263_1_.getString("id"));
    this.stackSize = p_i47263_1_.getByte("Count");
    this.itemDamage = Math.max(0, p_i47263_1_.getShort("Damage"));

    if (p_i47263_1_.hasKey("tag", 10))
    {
        this.stackTagCompound = p_i47263_1_.getCompoundTag("tag");

        if (this.item != null)
        {
            this.item.updateItemStackNBT(p_i47263_1_);
        }
    }

    this.func_190923_F();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:ItemStack.java

示例5: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
	super.readFromNBT(compound);
	inventory.deserializeNBT(compound.getCompoundTag("inv"));
	isCooking = compound.getBoolean("cooking");
	fuelTimer = compound.getInteger("fuel");
	maxFuelTimer = compound.getInteger("max");

	NBTTagCompound connections = compound.getCompoundTag("connections");
	System.out.println("read "+connections);
	for (int i = 0; i < 4; i++)
		if(connections.hasKey(String.valueOf(i)))
		{
			BlockPos pos = BlockPos.fromLong(connections.getLong(String.valueOf(i)));
			connected.add(pos);
		}
}
 
開發者ID:ArtixAllMighty,項目名稱:ExSartagine,代碼行數:18,代碼來源:TileEntityRange.java

示例6: readCapabilitiesFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public void readCapabilitiesFromNBT(NBTTagCompound tagCompound)
{
    if (tagCompound.hasKey("abilities", 10))
    {
        NBTTagCompound nbttagcompound = tagCompound.getCompoundTag("abilities");
        this.disableDamage = nbttagcompound.getBoolean("invulnerable");
        this.isFlying = nbttagcompound.getBoolean("flying");
        this.allowFlying = nbttagcompound.getBoolean("mayfly");
        this.isCreativeMode = nbttagcompound.getBoolean("instabuild");

        if (nbttagcompound.hasKey("flySpeed", 99))
        {
            this.flySpeed = nbttagcompound.getFloat("flySpeed");
            this.walkSpeed = nbttagcompound.getFloat("walkSpeed");
        }

        if (nbttagcompound.hasKey("mayBuild", 1))
        {
            this.allowEdit = nbttagcompound.getBoolean("mayBuild");
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:23,代碼來源:PlayerCapabilities.java

示例7: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.fireworkAge = tagCompund.getInteger("Life");
    this.lifetime = tagCompund.getInteger("LifeTime");
    NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("FireworksItem");

    if (nbttagcompound != null)
    {
        ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);

        if (itemstack != null)
        {
            this.dataWatcher.updateObject(8, itemstack);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:20,代碼來源:EntityFireworkRocket.java

示例8: renameWorld

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Renames the world by storing the new name in level.dat. It does *not* rename the directory containing the world
 * data.
 */
public void renameWorld(String dirName, String newName)
{
    File file1 = new File(this.savesDirectory, dirName);

    if (file1.exists())
    {
        File file2 = new File(file1, "level.dat");

        if (file2.exists())
        {
            try
            {
                NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(file2));
                NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
                nbttagcompound1.setString("LevelName", newName);
                CompressedStreamTools.writeCompressed(nbttagcompound, new FileOutputStream(file2));
            }
            catch (Exception exception)
            {
                exception.printStackTrace();
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:29,代碼來源:SaveFormatOld.java

示例9: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
	fluid = CauldronLiquid.getFromName(compound.getString("cauldronType"));
	level = compound.getInteger("cauldronLevel");
	isActive = compound.getBoolean("isActive");
	switchedItem = new ItemStack(compound.getCompoundTag("switchedItemStack"));
	super.readFromNBT(compound);
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:9,代碼來源:TileEntityHereticCauldron.java

示例10: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static Suction readFromNBT(NBTTagCompound tag) {
	if (tag.hasKey("Suction", Constants.NBT.TAG_COMPOUND)) {
		NBTTagCompound sucTag = tag.getCompoundTag("Suction");
		
		int str = sucTag.getInteger("strength");
		float min = sucTag.getFloat("minPurity");
		float max = sucTag.getFloat("maxPurity");
		
		return new Suction(str, min, max);
	}
	return NO_SUCTION;
}
 
開發者ID:the-realest-stu,項目名稱:Etheric,代碼行數:13,代碼來源:Suction.java

示例11: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    this.health = tagCompund.getShort("Health") & 255;
    this.age = tagCompund.getShort("Age");

    if (tagCompund.hasKey("PickupDelay"))
    {
        this.delayBeforeCanPickup = tagCompund.getShort("PickupDelay");
    }

    if (tagCompund.hasKey("Owner"))
    {
        this.owner = tagCompund.getString("Owner");
    }

    if (tagCompund.hasKey("Thrower"))
    {
        this.thrower = tagCompund.getString("Thrower");
    }

    NBTTagCompound nbttagcompound = tagCompund.getCompoundTag("Item");
    this.setEntityItemStack(ItemStack.loadItemStackFromNBT(nbttagcompound));

    if (this.getEntityItem() == null)
    {
        this.setDead();
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:32,代碼來源:EntityItem.java

示例12: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    NBTTagCompound randores = compound.getCompoundTag("randores");
    this.input.deserializeNBT(randores.getCompoundTag("input"));
    this.fuel.deserializeNBT(randores.getCompoundTag("fuel"));
    this.output.deserializeNBT(randores.getCompoundTag("output"));
    this.furnaceBurnTime = randores.getInteger("burn_time");
    this.cookTime = randores.getInteger("cook_time");
    this.totalCookTime = randores.getInteger("cook_time_total");
    this.divisor = randores.getInteger("furnace_speed");
    this.currentItemBurnTime = this.getBurnTime(this.fuel.getStackInSlot(0));
}
 
開發者ID:Randores,項目名稱:Randores2,代碼行數:14,代碼來源:CraftiniumForgeTileEntity.java

示例13: getWorldData

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Nullable
public static WorldInfo getWorldData(File p_186353_0_, DataFixer dataFixerIn)
{
    try
    {
        NBTTagCompound nbttagcompound = CompressedStreamTools.readCompressed(new FileInputStream(p_186353_0_));
        NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Data");
        return new WorldInfo(dataFixerIn.process(FixTypes.LEVEL, nbttagcompound1));
    }
    catch (Exception exception)
    {
        LOGGER.error("Exception reading {}", new Object[] {p_186353_0_, exception});
        return null;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:16,代碼來源:SaveFormatOld.java

示例14: readEntityFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound compound)
{
    super.readEntityFromNBT(compound);
    this.setProfession(compound.getInteger("Profession"));
    if (compound.hasKey("ProfessionName"))
    {
        net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession p =
            net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(new net.minecraft.util.ResourceLocation(compound.getString("ProfessionName")));
        if (p == null)
            p = net.minecraftforge.fml.common.registry.VillagerRegistry.instance().getRegistry().getValue(new net.minecraft.util.ResourceLocation("minecraft:farmer"));
        this.setProfession(p);
    }
    this.wealth = compound.getInteger("Riches");
    this.careerId = compound.getInteger("Career");
    this.careerLevel = compound.getInteger("CareerLevel");
    this.isWillingToMate = compound.getBoolean("Willing");

    if (compound.hasKey("Offers", 10))
    {
        NBTTagCompound nbttagcompound = compound.getCompoundTag("Offers");
        this.buyingList = new MerchantRecipeList(nbttagcompound);
    }

    NBTTagList nbttaglist = compound.getTagList("Inventory", 10);

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttaglist.getCompoundTagAt(i));

        if (itemstack != null)
        {
            this.villagerInventory.addItem(itemstack);
        }
    }

    this.setCanPickUpLoot(true);
    this.setAdditionalAItasks();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:42,代碼來源:EntityVillager.java

示例15: ActionOptions

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public ActionOptions(NBTTagCompound tagCompound) {
    NBTTagList list = tagCompound.getTagList("options", Constants.NBT.TAG_STRING);
    actionOptions = new ArrayList<>();
    for (int i = 0 ; i < list.tagCount() ; i++) {
        actionOptions.add(new MeeCreepActionType(list.getStringTagAt(i)));
    }

    list = tagCompound.getTagList("maybe", Constants.NBT.TAG_STRING);
    maybeActionOptions = new ArrayList<>();
    for (int i = 0 ; i < list.tagCount() ; i++) {
        maybeActionOptions.add(new MeeCreepActionType(list.getStringTagAt(i)));
    }

    list = tagCompound.getTagList("drops", Constants.NBT.TAG_COMPOUND);
    drops = new ArrayList<>();
    for (int i = 0 ; i < list.tagCount() ; i++) {
        NBTTagCompound tc = list.getCompoundTagAt(i);
        BlockPos p = BlockPos.fromLong(tc.getLong("p"));
        NBTTagCompound itemTag = tc.getCompoundTag("i");
        ItemStack stack = new ItemStack(itemTag);
        drops.add(Pair.of(p, stack));
    }

    dimension = tagCompound.getInteger("dim");
    targetPos = BlockPos.fromLong(tagCompound.getLong("pos"));
    targetSide = EnumFacing.VALUES[tagCompound.getByte("targetSide")];
    if (tagCompound.hasKey("player")) {
        playerId = tagCompound.getUniqueId("player");
    } else {
        playerId = null;
    }
    actionId = tagCompound.getInteger("actionId");
    timeout = tagCompound.getInteger("timeout");
    stage = Stage.getByCode(tagCompound.getString("stage"));
    if (tagCompound.hasKey("task")) {
        task = new MeeCreepActionType(tagCompound.getString("task"));
    }
    if (tagCompound.hasKey("fqid")) {
        furtherQuestionId = tagCompound.getString("fqid");
    } else {
        furtherQuestionId = null;
    }
    paused = tagCompound.getBoolean("paused");
}
 
開發者ID:McJty,項目名稱:MeeCreeps,代碼行數:45,代碼來源:ActionOptions.java


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