当前位置: 首页>>代码示例>>Java>>正文


Java NBTTagCompound.getLong方法代码示例

本文整理汇总了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();
}
 
开发者ID:Herobone,项目名称:HeroUtils,代码行数:18,代码来源:BaseTeslaContainer.java

示例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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:ChunkLoader.java

示例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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:19,代码来源:EntityMinecartContainer.java

示例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);
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:27,代码来源:Tile.java

示例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);
    }
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:12,代码来源:WaterStrawHandler.java

示例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));
    }
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:11,代码来源:RandoresWorldData.java

示例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");
    }
 
开发者ID:ImbaKnugel,项目名称:Whoosh,代码行数:11,代码来源:ItemTransporter.java

示例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;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:18,代码来源:SharedMonsterAttributes.java

示例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);
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:14,代码来源:TileMusicaPlant.java

示例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")));
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:40,代码来源:ExPAnimal.java

示例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);
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:30,代码来源:EntityMinecartContainer.java

示例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();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:60,代码来源:TileEntityStructure.java

示例13: getUUIDFromTag

import net.minecraft.nbt.NBTTagCompound; //导入方法依赖的package包/类
public static UUID getUUIDFromTag(NBTTagCompound tag) {
	return new UUID(tag.getLong("M"), tag.getLong("L"));
}
 
开发者ID:TominoCZ,项目名称:PAYDAY,代码行数:4,代码来源:LobbyTileEntity.java

示例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");
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:7,代码来源:TileCinderbella.java

示例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);
}
 
开发者ID:stuebz88,项目名称:modName,代码行数:54,代码来源:Empire.java


注:本文中的net.minecraft.nbt.NBTTagCompound.getLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。