本文整理汇总了Java中net.minecraft.nbt.NBTTagCompound.getLong方法的典型用法代码示例。如果您正苦于以下问题:Java NBTTagCompound.getLong方法的具体用法?Java NBTTagCompound.getLong怎么用?Java NBTTagCompound.getLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.nbt.NBTTagCompound
的用法示例。
在下文中一共展示了NBTTagCompound.getLong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserializeNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void deserializeNBT (NBTTagCompound nbt) {
this.stored = nbt.getLong("TeslaPower");
if (nbt.hasKey("TeslaCapacity"))
this.capacity = nbt.getLong("TeslaCapacity");
if (nbt.hasKey("TeslaInput"))
this.inputRate = nbt.getLong("TeslaInput");
if (nbt.hasKey("TeslaOutput"))
this.outputRate = nbt.getLong("TeslaOutput");
if (this.stored > this.getCapacity())
this.stored = this.getCapacity();
}
示例2: load
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static ChunkLoader.AnvilConverterData load(NBTTagCompound nbt)
{
int i = nbt.getInteger("xPos");
int j = nbt.getInteger("zPos");
ChunkLoader.AnvilConverterData chunkloader$anvilconverterdata = new ChunkLoader.AnvilConverterData(i, j);
chunkloader$anvilconverterdata.blocks = nbt.getByteArray("Blocks");
chunkloader$anvilconverterdata.data = new NibbleArrayReader(nbt.getByteArray("Data"), 7);
chunkloader$anvilconverterdata.skyLight = new NibbleArrayReader(nbt.getByteArray("SkyLight"), 7);
chunkloader$anvilconverterdata.blockLight = new NibbleArrayReader(nbt.getByteArray("BlockLight"), 7);
chunkloader$anvilconverterdata.heightmap = nbt.getByteArray("HeightMap");
chunkloader$anvilconverterdata.terrainPopulated = nbt.getBoolean("TerrainPopulated");
chunkloader$anvilconverterdata.entities = nbt.getTagList("Entities", 10);
chunkloader$anvilconverterdata.tileEntities = nbt.getTagList("TileEntities", 10);
chunkloader$anvilconverterdata.tileTicks = nbt.getTagList("TileTicks", 10);
try
{
chunkloader$anvilconverterdata.lastUpdated = nbt.getLong("LastUpdate");
}
catch (ClassCastException var5)
{
chunkloader$anvilconverterdata.lastUpdated = (long)nbt.getInteger("LastUpdate");
}
return chunkloader$anvilconverterdata;
}
示例3: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound compound)
{
super.readEntityFromNBT(compound);
this.minecartContainerItems = NonNullList.<ItemStack>func_191197_a(this.getSizeInventory(), ItemStack.field_190927_a);
if (compound.hasKey("LootTable", 8))
{
this.lootTable = new ResourceLocation(compound.getString("LootTable"));
this.lootTableSeed = compound.getLong("LootTableSeed");
}
else
{
ItemStackHelper.func_191283_b(compound, this.minecartContainerItems);
}
}
示例4: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static Tile readFromNBT(NBTTagCompound nbt, World world)
{
int x = nbt.getInteger("x");
int z = nbt.getInteger("z");
TileEnum.Biome tileType = TileEnum.Biome.values()[nbt.getInteger("type")];
boolean isOwned = nbt.getBoolean("isOwned");
int owners_size = nbt.getInteger("owners.size");
ArrayList<UUID> owners = new ArrayList<UUID>();
ArrayList<ArrayList<Integer>> ownersTime = new ArrayList<ArrayList<Integer>>();
for(int i=0; i<owners_size; i++)
{
String ownerID = "owner_"+i;
UUID owner = new UUID(nbt.getLong(ownerID+"_ID1"),nbt.getLong(ownerID+"_ID2"));
owners.add(owner);
ArrayList<Integer> ownerTime = new ArrayList<Integer>();
for(int j : nbt.getIntArray(ownerID+"_time"))
{
ownerTime.add(j);
}
ownersTime.add(ownerTime);
}
return new Tile(world,x,z,tileType,isOwned,owners,ownersTime);
}
示例5: onDrink
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void onDrink(World world, BlockPos pos, FluidStack stack, EntityPlayer player, boolean fromFluidContainer) {
player.extinguish();
NBTTagCompound tag = player.getEntityData();
if (tag.hasKey("lavaDrink") && world.getTotalWorldTime() - tag.getLong("lavaDrink") < 120) { //6 Seconds to drink water after drinking lava to create obsidian
player.entityDropItem(new ItemStack(Blocks.OBSIDIAN), player.getEyeHeight());
tag.setLong("lavaDrink", 0);
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_PLAYER_BURP, SoundCategory.PLAYERS, 1.5F, world.rand.nextFloat() * 0.1F + 0.9F);
}
}
示例6: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound nbt) {
this.seed = nbt.getLong("seed");
this.id = nbt.getUniqueId("id");
NBTTagCompound compound = nbt.getCompoundTag("pluginSeeds");
this.pluginSeeds.clear();
for(String key : compound.getKeySet()) {
this.pluginSeeds.put(key, compound.getLong(key));
}
}
示例7: getLastUsed
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static long getLastUsed(ItemStack stack) {
if(!stack.hasTagCompound())
return 0;
NBTTagCompound tag = stack.getTagCompound();
if(!tag.hasKey("LastUsed"))
return 0;
return tag.getLong("LastUsed");
}
示例8: readAttributeModifierFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* Creates an AttributeModifier from an NBTTagCompound
*/
public static AttributeModifier readAttributeModifierFromNBT(NBTTagCompound p_111259_0_)
{
UUID uuid = new UUID(p_111259_0_.getLong("UUIDMost"), p_111259_0_.getLong("UUIDLeast"));
try
{
return new AttributeModifier(uuid, p_111259_0_.getString("Name"), p_111259_0_.getDouble("Amount"), p_111259_0_.getInteger("Operation"));
}
catch (Exception exception)
{
logger.warn("Unable to create attribute: " + exception.getMessage());
return null;
}
}
示例9: readCustomNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readCustomNBT(NBTTagCompound tag) {
NBTTagList taglist = tag.getTagList(UCStrings.TAG_BEATLIST, 10);
for (int i = 0; i < taglist.tagCount(); i++) {
NBTTagCompound tag2 = taglist.getCompoundTagAt(i);
Note tagnote = Note.values()[tag2.getInteger(UCStrings.TAG_NOTE)];
Instrument taginst = Instrument.values()[tag2.getInteger(UCStrings.TAG_INST)];
Octave tagoct = Octave.values()[tag2.getInteger(UCStrings.TAG_OCT)];
long tagtime = tag2.getLong(UCStrings.TAG_TIME);
this.setNote(tagnote, taginst, tagoct, tagtime);
}
}
示例10: deserializeNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void deserializeNBT(NBTTagCompound nbt)
{
this.calendar.setTime(nbt.getLong("calendar"));
if (nbt.hasKey("packMost", Constants.NBT.TAG_LONG))
{
this.packID = new UUID(nbt.getLong("packMost"), nbt.getLong("packLeast"));
}
if (nbt.hasKey("pos"))
{
this.home = BlockPos.fromLong(nbt.getLong("pos"));
}
if (nbt.hasKey("offspring", Constants.NBT.TAG_LIST))
{
NBTTagList offspringList = nbt.getTagList("offspring", Constants.NBT.TAG_COMPOUND);
this.offspringStats = new IAnimalStats[offspringList.tagCount()];
for (int i = 0; i < offspringList.tagCount(); i++)
{
NBTTagCompound tag = offspringList.getCompoundTagAt(i);
try
{
this.offspringStats[i] = (IAnimalStats) Class.forName(tag.getString("class")).newInstance();
this.offspringStats[i].deserializeNBT(tag);
}
catch (Exception ignored)
{
}
}
}
this.hunger = nbt.getFloat("hunger");
this.thirst = nbt.getFloat("thirst");
this.isSick = nbt.getBoolean("isSick");
StreamSupport.stream(nbt.getTagList("familiarity", Constants.NBT.TAG_COMPOUND).spliterator(), false).map(n -> (NBTTagCompound)n).forEach(tag -> this.familiarityLevels.put(new UUID(tag.getLong("keyMost"), tag.getLong("keyLeast")), tag.getFloat("value")));
StreamSupport.stream(nbt.getTagList("interaction", Constants.NBT.TAG_COMPOUND).spliterator(), false).map(n -> (NBTTagCompound)n).forEach(tag -> this.interactionMemory.put(new UUID(tag.getLong("keyMost"), tag.getLong("keyLeast")), tag.getBoolean("value")));
}
示例11: readEntityFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
/**
* (abstract) Protected helper method to read subclass entity data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound compound)
{
super.readEntityFromNBT(compound);
this.minecartContainerItems = new ItemStack[this.getSizeInventory()];
if (compound.hasKey("LootTable", 8))
{
this.lootTable = new ResourceLocation(compound.getString("LootTable"));
this.lootTableSeed = compound.getLong("LootTableSeed");
}
else
{
NBTTagList nbttaglist = compound.getTagList("Items", 10);
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
int j = nbttagcompound.getByte("Slot") & 255;
if (j >= 0 && j < this.minecartContainerItems.length)
{
this.minecartContainerItems[j] = ItemStack.loadItemStackFromNBT(nbttagcompound);
}
}
}
}
示例12: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
this.setName(compound.getString("name"));
this.author = compound.getString("author");
this.metadata = compound.getString("metadata");
int i = MathHelper.clamp(compound.getInteger("posX"), -32, 32);
int j = MathHelper.clamp(compound.getInteger("posY"), -32, 32);
int k = MathHelper.clamp(compound.getInteger("posZ"), -32, 32);
this.position = new BlockPos(i, j, k);
int l = MathHelper.clamp(compound.getInteger("sizeX"), 0, 32);
int i1 = MathHelper.clamp(compound.getInteger("sizeY"), 0, 32);
int j1 = MathHelper.clamp(compound.getInteger("sizeZ"), 0, 32);
this.size = new BlockPos(l, i1, j1);
try
{
this.rotation = Rotation.valueOf(compound.getString("rotation"));
}
catch (IllegalArgumentException var11)
{
this.rotation = Rotation.NONE;
}
try
{
this.mirror = Mirror.valueOf(compound.getString("mirror"));
}
catch (IllegalArgumentException var10)
{
this.mirror = Mirror.NONE;
}
try
{
this.mode = TileEntityStructure.Mode.valueOf(compound.getString("mode"));
}
catch (IllegalArgumentException var9)
{
this.mode = TileEntityStructure.Mode.DATA;
}
this.ignoreEntities = compound.getBoolean("ignoreEntities");
this.powered = compound.getBoolean("powered");
this.showAir = compound.getBoolean("showair");
this.showBoundingBox = compound.getBoolean("showboundingbox");
if (compound.hasKey("integrity"))
{
this.integrity = compound.getFloat("integrity");
}
else
{
this.integrity = 1.0F;
}
this.seed = compound.getLong("seed");
this.updateBlockState();
}
示例13: getUUIDFromTag
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static UUID getUUIDFromTag(NBTTagCompound tag) {
return new UUID(tag.getLong("M"), tag.getLong("L"));
}
示例14: readCustomNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
@Override
public void readCustomNBT(NBTTagCompound tag) {
this.plantedCorrect = tag.getBoolean("UC_plantedCorrect");
this.timePlanted = tag.getLong("UC_timePlanted");
}
示例15: readFromNBT
import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static void readFromNBT (NBTTagCompound nbt, World world)
{
UUID empireID = new UUID(nbt.getLong("empireID1"), nbt.getLong("empireID2"));
boolean empireExists = nbt.getBoolean("empireExists");
String empireName = nbt.getString("empireName");
EmpireTurn empireTurn = EmpireTurn.readFromNBT(nbt);
int playerListSize = nbt.getInteger("playerListSize");
TreeMap<UUID, String> players = new TreeMap<UUID, String>();
for(int i = 0; i < playerListSize; i++)
{
String playerString = "player" + i + "_ID";
UUID playerID = new UUID(nbt.getLong(playerString + 1), nbt.getLong(playerString + 2));
players.put(playerID, nbt.getString("@player" + i));
}
int resourceListSize = nbt.getInteger("resourceListSize");
TreeMap<UUID, Long> resources = new TreeMap<UUID, Long>();
for(int i = 0; i < resourceListSize; i++)
{
UUID resourceID = new UUID(nbt.getLong("resource" + i + "_ID1"), nbt.getLong("resource" + i + "_ID2"));
resources.put(resourceID, nbt.getLong("resource" + i + "_amount"));
}
int territorySize = nbt.getInteger("territorySize");
TreeMap<TilePos, Integer> tiles = new TreeMap<TilePos, Integer>();
for(int i = 0; i < territorySize; i++)
{
String tileID = "#tile_" + i;
TilePos tilePos = new TilePos(nbt.getInteger(tileID + "X"), nbt.getInteger(tileID + "Z"));
tiles.put(tilePos, nbt.getInteger(tileID + "_length"));
}
int vassalListSize = nbt.getInteger("vassalListSize");
TreeMap<UUID, Integer> vassals = new TreeMap<UUID, Integer>();
for(int i = 0; i < vassalListSize; i++)
{
String vassalID = "#vassal_" + i;
UUID vassalUUID = new UUID(nbt.getLong(vassalID + "_ID1"), nbt.getLong(vassalID + "_ID2"));
vassals.put(vassalUUID, nbt.getInteger(vassalID + "_length"));
}
int cityListSize = nbt.getInteger("cityListSize");
TreeMap<UUID, Integer> cities = new TreeMap<UUID, Integer>();
for(int i = 0; i < cityListSize; i++)
{
String cityID = "#city_" + i;
UUID cityUUID = new UUID(nbt.getLong(cityID + "_ID1"), nbt.getLong(cityID + "_ID2"));
cities.put(cityUUID, nbt.getInteger(cityID + "_length"));
}
new Empire(empireID, empireExists, empireName, empireTurn, players, resources, tiles, vassals, cities, world);
}