本文整理汇总了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;
}
示例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()));
}
}
示例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");
}
示例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"));
}
}
}
示例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();
}
}
示例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)));
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
}
}
}
}
示例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));
}
}
}
}
示例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;
}
示例12: deserializeNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
for (String s : nbt.getKeySet())
{
setSteps(s, nbt.getInteger(s));
}
}
示例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));
}
}
示例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;
}
示例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;
}