本文整理匯總了Java中net.minecraft.nbt.NBTBase.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java NBTBase.getId方法的具體用法?Java NBTBase.getId怎麽用?Java NBTBase.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.nbt.NBTBase
的用法示例。
在下文中一共展示了NBTBase.getId方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseStructureData
import net.minecraft.nbt.NBTBase; //導入方法依賴的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: merge
import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public void merge(NBTTagCompound nbt, NBTTagCompound other) {
Iterator<String> iterator = other.func_150296_c().iterator();
while (iterator.hasNext()) {
String s = iterator.next();
NBTBase nbtbase = other.getTag(s);
if (nbtbase.getId() == 10) {
if (nbt.hasKey(s, 10)) {
NBTTagCompound nbttagcompound1 = nbt.getCompoundTag(s);
merge(nbttagcompound1, (NBTTagCompound) nbtbase);
} else
nbt.setTag(s, nbtbase.copy());
} else
nbt.setTag(s, nbtbase.copy());
}
}
示例3: func_143027_a
import net.minecraft.nbt.NBTBase; //導入方法依賴的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);
}
}
}
}
}
}
}
示例4: initializeStructureData
import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
protected void initializeStructureData(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(ChunkPos.asLong(i, j), structurestart);
}
}
}
}
}
}
}
示例5: initializeStructureData
import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
protected void initializeStructureData(World worldIn)
{
if (this.structureData == null)
{
this.structureData = (MapGenStructureData)worldIn.getPerWorldStorage().getOrLoadData(MapGenStructureData.class, this.getStructureName());
if (this.structureData == null)
{
this.structureData = new MapGenStructureData(this.getStructureName());
worldIn.getPerWorldStorage().setData(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(ChunkPos.asLong(i, j), structurestart);
}
}
}
}
}
}
}
示例6: readEntityFromNBT
import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
this.setAbsorptionAmount(tagCompund.getFloat("AbsorptionAmount"));
if (tagCompund.hasKey("Attributes", 9) && this.worldObj != null && !this.worldObj.isRemote)
{
SharedMonsterAttributes.func_151475_a(this.getAttributeMap(), tagCompund.getTagList("Attributes", 10));
}
if (tagCompund.hasKey("ActiveEffects", 9))
{
NBTTagList nbttaglist = tagCompund.getTagList("ActiveEffects", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);
if (potioneffect != null)
{
this.activePotionsMap.put(Integer.valueOf(potioneffect.getPotionID()), potioneffect);
}
}
}
if (tagCompund.hasKey("HealF", 99))
{
this.setHealth(tagCompund.getFloat("HealF"));
}
else
{
NBTBase nbtbase = tagCompund.getTag("Health");
if (nbtbase == null)
{
this.setHealth(this.getMaxHealth());
}
else if (nbtbase.getId() == 5)
{
this.setHealth(((NBTTagFloat)nbtbase).getFloat());
}
else if (nbtbase.getId() == 2)
{
this.setHealth((float)((NBTTagShort)nbtbase).getShort());
}
}
this.hurtTime = tagCompund.getShort("HurtTime");
this.deathTime = tagCompund.getShort("DeathTime");
this.revengeTimer = tagCompund.getInteger("HurtByTimestamp");
}
示例7: func_143027_a
import net.minecraft.nbt.NBTBase; //導入方法依賴的package包/類
private void func_143027_a(World worldIn)
{
if (this.structureData == null)
{
if (Reflector.ForgeWorld_getPerWorldStorage.exists())
{
MapStorage mapstorage = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]);
this.structureData = (MapGenStructureData)mapstorage.loadData(MapGenStructureData.class, this.getStructureName());
}
else
{
this.structureData = (MapGenStructureData)worldIn.loadItemData(MapGenStructureData.class, this.getStructureName());
}
if (this.structureData == null)
{
this.structureData = new MapGenStructureData(this.getStructureName());
if (Reflector.ForgeWorld_getPerWorldStorage.exists())
{
MapStorage mapstorage1 = (MapStorage)Reflector.call(worldIn, Reflector.ForgeWorld_getPerWorldStorage, new Object[0]);
mapstorage1.setData(this.getStructureName(), this.structureData);
}
else
{
worldIn.setItemData(this.getStructureName(), this.structureData);
}
}
else
{
NBTTagCompound nbttagcompound1 = this.structureData.getTagCompound();
for (String s : nbttagcompound1.getKeySet())
{
NBTBase nbtbase = nbttagcompound1.getTag(s);
if (nbtbase.getId() == 10)
{
NBTTagCompound nbttagcompound = (NBTTagCompound)nbtbase;
if (nbttagcompound.hasKey("ChunkX") && nbttagcompound.hasKey("ChunkZ"))
{
int i = nbttagcompound.getInteger("ChunkX");
int j = nbttagcompound.getInteger("ChunkZ");
StructureStart structurestart = MapGenStructureIO.getStructureStart(nbttagcompound, worldIn);
if (structurestart != null)
{
this.structureMap.put(Long.valueOf(ChunkCoordIntPair.chunkXZ2Int(i, j)), structurestart);
this.structureLongMap.add(ChunkCoordIntPair.chunkXZ2Int(i, j), structurestart);
}
}
}
}
}
}
}