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


Java NBTTagCompound.getKeySet方法代碼示例

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


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

示例1: parseStructureData

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
private static Set<Long> parseStructureData(MapGenStructureData data) {
    Set<Long> chunks = new HashSet<>();
    NBTTagCompound nbttagcompound = data.getTagCompound();

    for (String s : nbttagcompound.getKeySet()) {
        NBTBase nbtbase = nbttagcompound.getTag(s);

        if (nbtbase.getId() == 10) {
            NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbtbase;

            if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ")) {
                int i = nbttagcompound1.getInteger("ChunkX");
                int j = nbttagcompound1.getInteger("ChunkZ");
                chunks.add(ChunkPos.asLong(i, j));
            }
        }
    }
    return chunks;
}
 
開發者ID:McJty,項目名稱:InControl,代碼行數:20,代碼來源:StructureCache.java

示例2: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Nonnull
public static List<AnimaStack> readFromNBT(NBTTagCompound tag)
{
	if (tag != null)
	{
		List<AnimaStack> ret = new ArrayList<>();
		NBTTagCompound essTag = tag.getCompoundTag(E);
		for (String s : essTag.getKeySet())
			ret.add(new AnimaStack(Anima.REGISTRY.getValue(new ResourceLocation(s)), essTag.getInteger(s)));

		return ret;
	} else
	{
		return readFromNBT(writeDefaultAnimus(new NBTTagCompound()));
	}
}
 
開發者ID:raphydaphy,項目名稱:ArcaneMagic,代碼行數:17,代碼來源:AnimaStack.java

示例3: deserializeNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void deserializeNBT(NBTTagCompound nbt) {
	this.invisTicks = nbt.getByte("VisTicks");
	this.disguiseTicks = nbt.getByte("DisguiseTicks");
	this.setHealTarget(nbt.getInteger("HealTarget"));
	NBTTagCompound cld = nbt.getCompoundTag("Cooldowns");
	for (String key : cld.getKeySet())
		this.effectsCool.put(key, cld.getInteger(key));
	this.dataManager.set(HEADS, (int) nbt.getShort("Heads"));
	this.collectedHeadsTime = nbt.getShort("HeadsCool");
	this.setInvisible(nbt.getBoolean("Cloaked"));
	this.setDisguised(nbt.getBoolean("Disguised"));
	//this.owner.getDataManager().set(TF2EventBusListener.ENTITY_UBER, nbt.getBoolean("Uber"));
	this.setDisguiseType(nbt.getString("DisguiseType"));
	if (this.isDisguised())
		TF2EventsCommon.disguise(this.owner, true);
	this.killsSpinning=nbt.getInteger("KillsSpinning");
	this.focusShotTicks=nbt.getInteger("FocusedShot");
	this.fanCool=nbt.getInteger("KnockbackFANCool");
	//this.dodgedDmg=nbt.getFloat("DodgedDmg");
	this.setPhlogRage(nbt.getFloat("Phlog"));
	this.setMetal(nbt.getInteger("Metal"));
	this.setKnockbackRage(nbt.getFloat("KnockbackRage"));
	//this.killsSpinning=nbt.getInteger("KillsSpinning");
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:26,代碼來源:WeaponsCapability.java

示例4: addInformation

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, World world, List<String> curInfo, ITooltipFlag flag) {
    if (stack.hasTagCompound() && stack.getTagCompound().hasKey(PneumaticCraftUtils.SAVED_TANKS, Constants.NBT.TAG_COMPOUND)) {
        NBTTagCompound tag = stack.getTagCompound().getCompoundTag(PneumaticCraftUtils.SAVED_TANKS);
        for (String s : tag.getKeySet()) {
            NBTTagCompound tankTag = tag.getCompoundTag(s);
            FluidTank tank = new FluidTank(tankTag.getInteger("Amount"));
            tank.readFromNBT(tankTag);
            FluidStack fluidStack = tank.getFluid();
            if (fluidStack != null && fluidStack.amount > 0) {
                curInfo.add(fluidStack.getFluid().getLocalizedName(fluidStack) + ": " + fluidStack.amount + "mB");
            }
        }
    }
    if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) {
        TileEntity te = createTileEntity(world, getDefaultState());
        if (te instanceof TileEntityPneumaticBase) {
            float pressure = ((TileEntityPneumaticBase) te).dangerPressure;
            curInfo.add(TextFormatting.YELLOW + I18n.format("gui.tooltip.maxPressure", pressure));
        }
    }

    String info = "gui.tab.info." + stack.getUnlocalizedName();
    String translatedInfo = I18n.format(info);
    if (!translatedInfo.equals(info)) {
        if (PneumaticCraftRepressurized.proxy.isSneakingInGui()) {
            translatedInfo = TextFormatting.AQUA + translatedInfo.substring(2);
            if (!Loader.isModLoaded(ModIds.IGWMOD))
                translatedInfo += " \\n \\n" + I18n.format("gui.tab.info.assistIGW");
            curInfo.addAll(PneumaticCraftUtils.convertStringIntoList(translatedInfo, 40));
        } else {
            curInfo.add(TextFormatting.AQUA + I18n.format("gui.tooltip.sneakForInfo"));
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:37,代碼來源:BlockPneumaticCraft.java

示例5: loadIdCounts

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Loads the idCounts Map from the 'idcounts' file.
 */
private void loadIdCounts()
{
    try
    {
        this.idCounts.clear();

        if (this.saveHandler == null)
        {
            return;
        }

        File file1 = this.saveHandler.getMapFileFromName("idcounts");

        if (file1 != null && file1.exists())
        {
            DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));
            NBTTagCompound nbttagcompound = CompressedStreamTools.read(datainputstream);
            datainputstream.close();

            for (String s : nbttagcompound.getKeySet())
            {
                NBTBase nbtbase = nbttagcompound.getTag(s);

                if (nbtbase instanceof NBTTagShort)
                {
                    NBTTagShort nbttagshort = (NBTTagShort)nbtbase;
                    short short1 = nbttagshort.getShort();
                    this.idCounts.put(s, Short.valueOf(short1));
                }
            }
        }
    }
    catch (Exception exception)
    {
        exception.printStackTrace();
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:41,代碼來源:MapStorage.java

示例6: deserializeNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void deserializeNBT(NBTTagCompound nbt) {
	eventFlag=nbt.getInteger("Event");
	NBTTagCompound items=nbt.getCompoundTag("Items");
	for(String key:items.getKeySet()){
		MerchantRecipeList handler=new MerchantRecipeList();
		handler.readRecipiesFromTags(items.getCompoundTag(key));
		lostItems.put(key, handler);
	}
	NBTTagList bannersS=nbt.getTagList("Banners", 9);
	for(int i=0;i<bannersS.tagCount();i++){
		NBTTagList coords=(NBTTagList) bannersS.get(i);
		banners.add(new BlockPos(coords.getIntAt(0),coords.getIntAt(1),coords.getIntAt(2)));
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:16,代碼來源:TF2EventsCommon.java

示例7: addValue

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
public static float addValue(float value, NBTTagCompound attributelist, String effect) {
	for(String name : attributelist.getKeySet()) {
		NBTBase tag = attributelist.getTag(name);
		if (tag instanceof NBTTagFloat) {
			TF2Attribute attribute = attributes[Integer.parseInt(name)];
			if (attribute != null && attribute.effect.equals(effect))
				if (attribute.typeOfValue == Type.ADDITIVE)
					value += ((NBTTagFloat) tag).getFloat();
				else
					value *= ((NBTTagFloat) tag).getFloat();
		}
	}
	return value;
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:15,代碼來源:TF2Attribute.java

示例8: readFromNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
/**
 * Set defined game rules from NBT.
 */
public void readFromNBT(NBTTagCompound nbt)
{
    for (String s : nbt.getKeySet())
    {
        String s1 = nbt.getString(s);
        this.setOrCreateGameRule(s, s1);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:12,代碼來源:GameRules.java

示例9: func_143027_a

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
private void func_143027_a(World worldIn)
{
    if (this.structureData == null)
    {
        this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());

        if (this.structureData == null)
        {
            this.structureData = new MapGenStructureData(this.getStructureName());
            worldIn.setItemData(this.getStructureName(), this.structureData);
        }
        else
        {
            NBTTagCompound nbttagcompound = this.structureData.getTagCompound();

            for (String s : nbttagcompound.getKeySet())
            {
                NBTBase nbtbase = nbttagcompound.getTag(s);

                if (nbtbase.getId() == 10)
                {
                    NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbtbase;

                    if (nbttagcompound1.hasKey("ChunkX") && nbttagcompound1.hasKey("ChunkZ"))
                    {
                        int i = nbttagcompound1.getInteger("ChunkX");
                        int j = nbttagcompound1.getInteger("ChunkZ");
                        StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound1, worldIn);

                        if (structurestart != null)
                        {
                            this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart);
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:40,代碼來源:MapGenStructure.java

示例10: readNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void readNBT(Capability<IWeaponSkillInfo> capability, IWeaponSkillInfo instance, EnumFacing side, NBTBase nbt) {
	if (nbt instanceof NBTTagCompound) {
		NBTTagCompound tag = (NBTTagCompound)nbt;
		if (tag.hasKey("Cooldown",    TYPE_NBT_INT)) instance.setCooldown(tag.getInteger("Cooldown"));
		if (tag.hasKey("MaxCooldown", TYPE_NBT_INT)) instance.setMaxCooldown(tag.getInteger("MaxCoodlown"));
		if (tag.hasKey("Resources",   TYPE_NBT_COMPOUND)) {
			NBTTagCompound map = tag.getCompoundTag("Resources");
			for(String name : map.getKeySet()) {
				ResourceLocation id = new ResourceLocation(name);
				if (map.hasKey(name, TYPE_NBT_INT)) instance.set(id, map.getInteger(name));
			}
		}
	}
}
 
開發者ID:elytra,項目名稱:Thermionics,代碼行數:16,代碼來源:DefaultWeaponSkillInfoSerializer.java

示例11: apply

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public boolean apply(@Nullable ItemStack used)
{
    if (used != null)
    {
        for (ItemStack stack : getMatchingStacks())
        {
            if (stack.getItem() == used.getItem())
            {
                int i = stack.getMetadata();
                if (i == 32767 || i == used.getMetadata())
                {
                    if (used.getTagCompound() != null && stack.getTagCompound() != null)
                    {
                        NBTTagCompound tagStack = stack.getTagCompound();
                        NBTTagCompound tagUsed = used.getTagCompound();
                        for (String s : tagStack.getKeySet())
                        {
                            if (!tagUsed.hasKey(s))
                                return false;
                            if (!tagUsed.getTag(s).equals(tagStack.getTag(s)))
                                return false;
                        }
                    }
                    return true;
                }
            }
        }
    }
    return false;
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:32,代碼來源:IngredientNBT.java

示例12: deserializeNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
    for (String s : nbt.getKeySet())
    {
        setSteps(s, nbt.getInteger(s));
    }
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:9,代碼來源:IfEntryStore.java

示例13: deserializeNBT

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
    for (String type : nbt.getKeySet())
    {
        sip.put(type, nbt.getInteger(type));
    }
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:9,代碼來源:SipStore.java

示例14: matchesAnyChild

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
private boolean matchesAnyChild(NBTBase p_matchesAnyChild_1_)
{
    if (p_matchesAnyChild_1_ instanceof NBTTagCompound)
    {
        NBTTagCompound nbttagcompound = (NBTTagCompound)p_matchesAnyChild_1_;

        for (String s : nbttagcompound.getKeySet())
        {
            NBTBase nbtbase = nbttagcompound.getTag(s);

            if (this.matches(nbtbase))
            {
                return true;
            }
        }
    }

    if (p_matchesAnyChild_1_ instanceof NBTTagList)
    {
        NBTTagList nbttaglist = (NBTTagList)p_matchesAnyChild_1_;
        int i = nbttaglist.tagCount();

        for (int j = 0; j < i; ++j)
        {
            NBTBase nbtbase1 = nbttaglist.get(j);

            if (this.matches(nbtbase1))
            {
                return true;
            }
        }
    }

    return false;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:36,代碼來源:NbtTagValue.java

示例15: spawnNewEntity

import net.minecraft.nbt.NBTTagCompound; //導入方法依賴的package包/類
private Entity spawnNewEntity(Entity entityIn, boolean spawn)
{
    if (this.getRandomEntity() != null)
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();
        entityIn.writeToNBTOptional(nbttagcompound);

        for (String s : this.getRandomEntity().nbtData.getKeySet())
        {
            NBTBase nbtbase = this.getRandomEntity().nbtData.getTag(s);
            nbttagcompound.setTag(s, nbtbase.copy());
        }

        entityIn.readFromNBT(nbttagcompound);

        if (entityIn.worldObj != null && spawn)
        {
            entityIn.worldObj.spawnEntityInWorld(entityIn);
        }

        NBTTagCompound nbttagcompound2;

        for (Entity entity = entityIn; nbttagcompound.hasKey("Riding", 10); nbttagcompound = nbttagcompound2)
        {
            nbttagcompound2 = nbttagcompound.getCompoundTag("Riding");
            Entity entity1 = EntityList.createEntityByName(nbttagcompound2.getString("id"), entityIn.worldObj);

            if (entity1 != null)
            {
                NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                entity1.writeToNBTOptional(nbttagcompound1);

                for (String s1 : nbttagcompound2.getKeySet())
                {
                    NBTBase nbtbase1 = nbttagcompound2.getTag(s1);
                    nbttagcompound1.setTag(s1, nbtbase1.copy());
                }

                entity1.readFromNBT(nbttagcompound1);
                entity1.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch);

                if (entityIn.worldObj != null && spawn)
                {
                    entityIn.worldObj.spawnEntityInWorld(entity1);
                }

                entity.mountEntity(entity1);
            }

            entity = entity1;
        }
    }
    else if (entityIn instanceof EntityLivingBase && entityIn.worldObj != null && spawn)
    {
        if (entityIn instanceof EntityLiving)
        {
            ((EntityLiving)entityIn).onInitialSpawn(entityIn.worldObj.getDifficultyForLocation(new BlockPos(entityIn)), (IEntityLivingData)null);
        }

        entityIn.worldObj.spawnEntityInWorld(entityIn);
    }

    return entityIn;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:65,代碼來源:MobSpawnerBaseLogic.java


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