java类net.minecraft.nbt.NBTTagInt的实例源码

CapabilityChunkLevel.java 文件源码 项目:Loot-Slash-Conquer 阅读 25 收藏 0 点赞 0 评论 0
@SubscribeEvent
public static void onChunkLoad(ChunkDataEvent.Load event)
{
    World world = event.getWorld();
    ChunkPos chunkPos = event.getChunk().getPos();

    IChunkLevelHolder chunkLevelHolder = getChunkLevelHolder(world);
    ChunkLevel chunkLevel = new ChunkLevel(world, chunkPos, getAreaLevel(world, chunkPos));

    NBTTagCompound nbt = event.getData();

    if (nbt.hasKey(ID.toString(), Constants.NBT.TAG_INT))
    {
        NBTTagInt levelTag = (NBTTagInt) nbt.getTag(ID.toString());
        chunkLevel.deserializeNBT(levelTag);
    }

    chunkLevelHolder.setChunkLevel(null, chunkLevel);
}
NbtTagValue.java 文件源码 项目:Backmemed 阅读 19 收藏 0 点赞 0 评论 0
private static NBTBase getChildTag(NBTBase p_getChildTag_0_, String p_getChildTag_1_)
{
    if (p_getChildTag_0_ instanceof NBTTagCompound)
    {
        NBTTagCompound nbttagcompound = (NBTTagCompound)p_getChildTag_0_;
        return nbttagcompound.getTag(p_getChildTag_1_);
    }
    else if (p_getChildTag_0_ instanceof NBTTagList)
    {
        NBTTagList nbttaglist = (NBTTagList)p_getChildTag_0_;

        if (p_getChildTag_1_.equals("count"))
        {
            return new NBTTagInt(nbttaglist.tagCount());
        }
        else
        {
            int i = Config.parseInt(p_getChildTag_1_, -1);
            return i < 0 ? null : nbttaglist.get(i);
        }
    }
    else
    {
        return null;
    }
}
TF2EventsCommon.java 文件源码 项目:Mods 阅读 24 收藏 0 点赞 0 评论 0
@Override
public NBTTagCompound serializeNBT() {
    NBTTagCompound nbt=new NBTTagCompound();
    nbt.setInteger("Event", eventFlag);
    NBTTagCompound items=new NBTTagCompound();
    nbt.setTag("Items", items);
    NBTTagList bannersS = new NBTTagList();
    for(BlockPos pos:banners){

        NBTTagList coords = new NBTTagList();
        coords.appendTag(new NBTTagInt(pos.getX()));
        coords.appendTag(new NBTTagInt(pos.getY()));
        coords.appendTag(new NBTTagInt(pos.getZ()));
        bannersS.appendTag(coords);
    }
    nbt.setTag("Banners", bannersS);
    for(Entry<String,MerchantRecipeList> entry:lostItems.entrySet()){
        items.setTag(entry.getKey(), entry.getValue().getRecipiesAsTags());
    }
    return nbt;
}
TileEntityEnderThermicLavaPump.java 文件源码 项目:ExtraUtilities 阅读 17 收藏 0 点赞 0 评论 0
public void readFromNBT(final NBTTagCompound par1NBTTagCompound) {
    super.readFromNBT(par1NBTTagCompound);
    if (par1NBTTagCompound.hasKey("block_no") && par1NBTTagCompound.getTag("block_no") instanceof NBTTagInt) {
        this.b = par1NBTTagCompound.getInteger("block_no");
    }
    else {
        LogHelper.info("Extra Utilities: Problem loading EnderPump TileEntity Tag (block_no)", new Object[0]);
    }
    if (par1NBTTagCompound.hasKey("chunk_no") && par1NBTTagCompound.getTag("chunk_no") instanceof NBTTagByte) {
        this.chunk_no = par1NBTTagCompound.getByte("chunk_no");
    }
    else {
        LogHelper.info("Extra Utilities: Problem loading EnderPump TileEntity Tag (chunk_no)", new Object[0]);
    }
    if (this.chunk_no == -128) {
        this.finished = true;
    }
    else {
        this.setChunk(this.chunk_no);
    }
    this.tank.readFromNBT(par1NBTTagCompound.getCompoundTag("tank"));
    this.init = true;
}
ItemTeletoryPortalLinker.java 文件源码 项目:TeleToro 阅读 23 收藏 0 点赞 0 评论 0
private void linkPortalWithOrigin(EntityPlayer player, World world, ItemStack stack, ControlBlockLocation thisPortal,
        PortalLinkerOrigin remoteInfo) {

    ControlBlockLocation remotePortal = findControllerBlock(world, remoteInfo.pos, STANDARD_SIZER);

    stack.setTagInfo("origin", new NBTTagLong(0));
    stack.setTagInfo("dimid", new NBTTagInt(0));

    if (remotePortal == null) {
        return;
    }

    linkPortalTo(world, thisPortal, remotePortal, remoteInfo.dimId, remoteInfo.side);
    linkPortalTo(world, remotePortal, thisPortal, player.dimension, getSide(player, thisPortal));

    playSound(player);
    stack.damageItem(1, player);
}
ClientProxy.java 文件源码 项目:ToroHealth 阅读 19 收藏 0 点赞 0 评论 0
@Override
public void displayDamageDealt(EntityLivingBase entity) {

    if (!entity.world.isRemote) {
        return;
    }

    if (!ConfigurationHandler.showDamageParticles) {
        return;
    }

    int currentHealth = (int) Math.ceil(entity.getHealth());

    if (entity.getEntityData().hasKey("health")) {
        int entityHealth = ((NBTTagInt) entity.getEntityData().getTag("health")).getInt();

        if (entityHealth != currentHealth) {
            displayParticle(entity, (int) entityHealth - currentHealth);
        }
    }

    entity.getEntityData().setTag("health", new NBTTagInt(currentHealth));
}
MCFluxEvents.java 文件源码 项目:Minecraft-Flux 阅读 23 收藏 0 点赞 0 评论 0
@SubscribeEvent
public static void onPlayerLogin(PlayerEvent.PlayerLoggedInEvent e) {
    if (MCFlux.UPDATE_CHECK_FINISHED && !MCFlux.NEWER_VERSION.isEmpty() && e.player instanceof EntityPlayerMP)
        MCFluxNetwork.to(Msg.newVersion(MCFlux.NEWER_VERSION), (EntityPlayerMP) e.player);
    if (SpecialEventHandler.getEventStatus() == SpecialEventHandler.EventStatus.DOWNLOADED) {
        final SpecialEventReceiver ser = e.player.getCapability(SpecialEventReceiver.SELF_CAP, null);
        if (ser != null) {
            final int[] seids = SpecialEventHandler.getEventIDs();
            for (int l : seids) {
                if (ser.alreadyReceived(l))
                    continue;
                final ItemStack is = new ItemStack(MCFluxResources.SPECIAL);
                is.setTagInfo("seid", new NBTTagInt(l));
                e.player.dropItem(is, false, true);
                ser.addReceived(l);
            }
        }
    }
}
TileEntityConveyor.java 文件源码 项目:T.E.C.H 阅读 20 收藏 0 点赞 0 评论 0
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
    super.writeToNBT(compound);
    NBTTagCompound itemsMap = new NBTTagCompound();
    NBTTagList keys = new NBTTagList();
    NBTTagList values = new NBTTagList();
    itemsMap.setInteger("size", itemMap.size());
    for (Map.Entry<Integer, Integer> ent : itemMap.entrySet()) {
        NBTTagInt key = new NBTTagInt(ent.getKey());
        NBTTagInt value = new NBTTagInt(ent.getValue());
        keys.appendTag(key);
        values.appendTag(value);
    }
    itemsMap.setTag("keys", keys);
    itemsMap.setTag("values", values);
    compound.setTag("itemsMap", itemsMap);
    compound.setTag("items", itemStackHandler.serializeNBT());
    return compound;
}
UndoRegion.java 文件源码 项目:TaleCraft 阅读 29 收藏 0 点赞 0 评论 0
public NBTTagCompound toNBT(){
    NBTTagCompound tag = new NBTTagCompound();
    tag.setInteger("x", xPos);
    tag.setInteger("y", yPos);
    tag.setInteger("z", zPos);

    tag.setInteger("width", width);
    tag.setInteger("height", height);
    tag.setInteger("length", length);

    tag.setInteger("world", world.provider.getDimension());

    NBTTagList list = new NBTTagList();
    for(IBlockState state : blocks){
        list.appendTag(new NBTTagInt(Block.getStateId(state)));
    }
    tag.setTag("blocks", list);
    return tag;
}
NBTHelper.java 文件源码 项目:TaleCraft 阅读 20 收藏 0 点赞 0 评论 0
private static void asJson(NBTBase tag, StringBuilder builder) {
    switch(tag.getId()) {
    case NBT.TAG_BYTE: builder.append(((NBTTagByte)tag).getByte()).append('b'); break;
    case NBT.TAG_SHORT: builder.append(((NBTTagShort)tag).getByte()).append('b'); break;
    case NBT.TAG_INT: builder.append(((NBTTagInt)tag).getInt()); break;
    case NBT.TAG_LONG: builder.append(((NBTTagLong)tag).getByte()).append('l'); break;
    case NBT.TAG_FLOAT: builder.append(((NBTTagFloat)tag).getFloat()).append('f'); break;
    case NBT.TAG_DOUBLE: builder.append(((NBTTagDouble)tag).getDouble()).append('d'); break;
    case NBT.TAG_STRING: builder.append('"').append(((NBTTagString)tag).getString()).append('"'); break;
    case NBT.TAG_BYTE_ARRAY: builder.append(Arrays.toString(((NBTTagByteArray)tag).getByteArray())); break;
    case NBT.TAG_INT_ARRAY: builder.append(Arrays.toString(((NBTTagIntArray)tag).getIntArray())); break;
    case NBT.TAG_COMPOUND: asJson((NBTTagCompound) tag, builder); break;
    case NBT.TAG_LIST: asJson((NBTTagList) tag, builder); break;
    }

}
TechTree.java 文件源码 项目:CivCraft 阅读 18 收藏 0 点赞 0 评论 0
private Tech(NBTTagCompound nbt, String name) {
    this.name = name;
    NBTTagList parents = nbt.getTagList("parents", Lib.NBT.STRING);
    for (int idx = 0; idx < parents.tagCount(); idx++) {
        String parentName = parents.getStringTagAt(idx);
        Tech parent = TechTree.this.getTech(parentName);
        addRequirement(parent);
    }
    NBTTagList sciencePacks = nbt.getTagList("sciencePacks", Lib.NBT.INTEGER);
    int[] required = new int[sciencePacks.tagCount()];
    for (int idx = 0; idx < sciencePacks.tagCount(); idx++) {
        required[idx] = ((NBTTagInt) sciencePacks.get(idx)).getInt();
    }
    this.sciencePacks = required;
    leafTech = nbt.getBoolean("leaf");
    if (leafTech)
        setLeafTech();
}
ConfigCompat.java 文件源码 项目:CivCraft 阅读 18 收藏 0 点赞 0 评论 0
@SubscribeEvent(priority = EventPriority.LOWEST)
public void addTechs(AddTechs t) {
    TechTree tree = t.tree;
    NBTTagCompound n = t.treeNBTCompound;
    NBTTagCompound techs = n.getCompoundTag("techs");

    for (Object key : techs.getKeySet()) {
        NBTTagCompound tech = techs.getCompoundTag((String) key);
        // Almost directly copied from new TechTree.Tech()
        Tech techAdded = tree.addTech((String) key);
        NBTTagList nbtparents = tech.getTagList("parents", Lib.NBT.STRING);
        for (int idx = 0; idx < nbtparents.tagCount(); idx++) {
            String parentName = nbtparents.getStringTagAt(idx);
            Tech parent = tree.getTech(parentName);
            techAdded.addRequirement(parent);
        }
        NBTTagList sciencePacks = tech.getTagList("sciencePacks", Lib.NBT.INTEGER);
        int[] required = new int[sciencePacks.tagCount()];
        for (int idx = 0; idx < sciencePacks.tagCount(); idx++) {
            required[idx] = ((NBTTagInt) sciencePacks.get(idx)).getInt();
        }
        techAdded.setSciencePacksNeeded(required);
        if (tech.getBoolean("leaf"))
            techAdded.setLeafTech();
    }
}
BlockChangeBlock.java 文件源码 项目:ToggleBlocks 阅读 16 收藏 0 点赞 0 评论 0
public static void updateRemainingChangeBlocks(ItemStack stack, World world)
{
    ControllerInfo info = new ControllerInfo(stack);
    if (info.initialized)
    {
        int x = info.x, y = info.y, z = info.z;
        TileEntity entity = world.getTileEntity(x, y, z);
        if (entity instanceof IToggleController)
        {
            IToggleController controller = (IToggleController) entity;
            int max = controller.getMaxChangeBlocks();
            int remaining = max != -1 ? controller.getMaxChangeBlocks() - controller.getRegisteredChangeBlockCount() : -1;
            if (remaining == 0)
                stack.stackSize = 0;
            stack.setTagInfo(REMAINING_CHANGE_BLOCKS, new NBTTagInt(remaining));
        }
    }
}
NbtUtils.java 文件源码 项目:copycore 阅读 22 收藏 0 点赞 0 评论 0
/** Creates and returns a primitive NBT tag from a value.
 *  If the value already is an NBT tag, it is returned instead. */
public static NBTBase createTag(Object value) {
    if (value == null)
        throw new IllegalArgumentException("value is null");
    if (value instanceof NBTBase) return (NBTBase)value;
    if (value instanceof Byte)    return new NBTTagByte((Byte)value);
    if (value instanceof Short)   return new NBTTagShort((Short)value);
    if (value instanceof Integer) return new NBTTagInt((Integer)value);
    if (value instanceof Long)    return new NBTTagLong((Long)value);
    if (value instanceof Float)   return new NBTTagFloat((Float)value);
    if (value instanceof Double)  return new NBTTagDouble((Double)value);
    if (value instanceof String)  return new NBTTagString((String)value);
    if (value instanceof byte[])  return new NBTTagByteArray((byte[])value);
    if (value instanceof int[])   return new NBTTagIntArray((int[])value);
    throw new IllegalArgumentException("Can't create an NBT tag of value: " + value);
}
ConvertNBTTagCompound.java 文件源码 项目:CraftingManager 阅读 20 收藏 0 点赞 0 评论 0
public static Object getObject(NBTBase base)
{
    if(base instanceof NBTTagByte)
        return ((NBTTagByte)base).func_150290_f();
    if(base instanceof NBTTagShort)
        return ((NBTTagShort)base).func_150289_e();
    if(base instanceof NBTTagInt)
        return ((NBTTagInt)base).func_150287_d();
    if(base instanceof NBTTagLong)
        return ((NBTTagLong)base).func_150291_c();
    if(base instanceof NBTTagFloat)
        return ((NBTTagFloat)base).func_150288_h();
    if(base instanceof NBTTagDouble)
        return ((NBTTagDouble)base).func_150286_g();
    if(base instanceof NBTTagByteArray)
        return ((NBTTagByteArray)base).func_150292_c();
    if(base instanceof NBTTagString)
        return ((NBTTagString)base).func_150285_a_();
    if(base instanceof NBTTagList)
        return base;
    if(base instanceof NBTTagCompound)
        return ((NBTTagCompound)base);
    if(base instanceof NBTTagIntArray)
        return ((NBTTagIntArray)base).func_150302_c();
    return null;
}
GuiEditNBT.java 文件源码 项目:NBTEdit 阅读 19 收藏 0 点赞 0 评论 0
private static void setValidValue(Node<NamedNBT> node, String value){
    NamedNBT named = node.getObject();
    NBTBase base = named.getNBT();

    if (base instanceof NBTTagByte)
        named.setNBT(new NBTTagByte(ParseHelper.parseByte(value)));
    if (base instanceof NBTTagShort)
        named.setNBT(new NBTTagShort(ParseHelper.parseShort(value)));
    if (base instanceof NBTTagInt)
        named.setNBT(new NBTTagInt(ParseHelper.parseInt(value)));
    if (base instanceof NBTTagLong)
        named.setNBT(new NBTTagLong(ParseHelper.parseLong(value)));
    if(base instanceof NBTTagFloat)
        named.setNBT(new NBTTagFloat(ParseHelper.parseFloat(value)));
    if(base instanceof NBTTagDouble)
        named.setNBT(new NBTTagDouble(ParseHelper.parseDouble(value)));
    if(base instanceof NBTTagByteArray)
        named.setNBT(new NBTTagByteArray(ParseHelper.parseByteArray(value)));
    if(base instanceof NBTTagIntArray)
        named.setNBT(new NBTTagIntArray(ParseHelper.parseIntArray(value)));
    if (base instanceof NBTTagString)
        named.setNBT(new NBTTagString(value));
}
EntityStats.java 文件源码 项目:Dota2Items 阅读 18 收藏 0 点赞 0 评论 0
@Override
public void saveNBTData(NBTTagCompound compound) {
    compound.setFloat(TAG_MANA, getFloatMana());
    compound.setFloat(TAG_PARTIAL_HP, partialHalfHeart);
    compound.setFloat(TAG_RELIABLE_GOLD, getReliableGold());
    compound.setFloat(TAG_UNRELIABLE_GOLD, getUnreliableGold());
    NBTTagList buffsList = new NBTTagList();
    for (BuffInstance buffInst : appliedBuffs) {
        buffsList.appendTag(buffInst.toNBT());
    }
    compound.setTag(TAG_BUFFS, buffsList);
    NBTTagList attackersList = new NBTTagList();
    synchronized (playerAttackersIDs) {
        for (Integer playerID : playerAttackersIDs) {
            attackersList.appendTag(new NBTTagInt(TAG_ATTACKER_ID, playerID.intValue()));
        }
    }
    compound.setTag(TAG_ATTACKERS, attackersList);
}
EntityStats.java 文件源码 项目:Dota2Items 阅读 20 收藏 0 点赞 0 评论 0
@Override
public void loadNBTData(NBTTagCompound compound) {
    this.curMana = compound.getFloat(TAG_MANA);
    this.partialHalfHeart = compound.getFloat(TAG_PARTIAL_HP);
    this.reliableGold = compound.getFloat(TAG_RELIABLE_GOLD);
    this.unreliableGold = compound.getFloat(TAG_UNRELIABLE_GOLD);
    NBTTagList buffsList = compound.getTagList(TAG_BUFFS);
    for (int i = 0; i < buffsList.tagCount(); i++) {
        NBTTagCompound buffTag = (NBTTagCompound) buffsList.tagAt(i);
        BuffInstance buffInst = BuffInstance.fromNBT(buffTag, entity);
        addBuff(buffInst);
    }
    NBTTagList attackersList = compound.getTagList(TAG_ATTACKERS);
    for (int i = 0; i < attackersList.tagCount(); i++) {
        NBTTagInt playerID = (NBTTagInt) attackersList.tagAt(i);
        addPlayerAttackerID(playerID.data);
    }
}
MagicHelper.java 文件源码 项目:VillagerTweaks 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Returns all valid golem enchantments in the given pumpkin.
 * 
 */
public static int[] getEnchantmentIds(ItemStack itemStack) {
    int[] enchants = null;

    if (itemStack.getItem() == Item.getItemFromBlock(Blocks.pumpkin)) {
        // Get a tagList of type 3 (integers)
        NBTTagList tag = itemStack.hasTagCompound() ? itemStack.getTagCompound().getTagList(MagicHelper.GolemEnchantmentsNBTKey, 3) : null;

        // Loads the enchantments
        if (tag != null && !tag.hasNoTags()) {
            enchants = new int[tag.tagCount()]; 
            for (int i = 0; i < enchants.length; i++) {
                int enchId = ((NBTTagInt)tag.get(i)).getInt();
                enchants[i] = enchId;
            }
        }

    }

    return enchants;
}
ItemSplitterTile.java 文件源码 项目:Industrial-Foregoing 阅读 18 收藏 0 点赞 0 评论 0
public ItemSplitterTile() {
    super(ItemSplitterTile.class.getName().hashCode());
    input = this.addSimpleInventory(3, "input", EnumDyeColor.BLUE, "input items", new BoundingRectangle(18, 25, 18, 18 * 3), (stack, integer) -> true, (stack, integer) -> false, true, 0);
    fakeOut = this.addSimpleInventory(0, "out", EnumDyeColor.ORANGE, "output items", new BoundingRectangle(30, 90, 0, 0), (stack, integer) -> false, (stack, integer) -> false, false, 0);
    tick = 1;
    size = 1;
    registerSyncIntPart("size", nbtTagInt -> size = nbtTagInt.getInt(), () -> new NBTTagInt(size), SyncProviderLevel.GUI);
}
HarshenTemplate.java 文件源码 项目:harshencastle 阅读 24 收藏 0 点赞 0 评论 0
private NBTTagList writeInts(int... values)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (int i : values)
    {
        nbttaglist.appendTag(new NBTTagInt(i));
    }

    return nbttaglist;
}
CapabilityAnima.java 文件源码 项目:Anima-Mundi 阅读 20 收藏 0 点赞 0 评论 0
@Override
public void readNBT(Capability<IAnimaStorage> capability, IAnimaStorage instance, EnumFacing side, NBTBase nbt)
{
    if(!(instance instanceof AnimaStorage))
        throw new IllegalArgumentException("Can not deserialize to an instance that isn't the default implementation");
    ((AnimaStorage) instance).energy = ((NBTTagInt) nbt).getInt();
}
DefaultHeatStorageSerializer.java 文件源码 项目:Thermionics 阅读 17 收藏 0 点赞 0 评论 0
@Override
public NBTBase writeNBT(Capability<IHeatStorage> capability, IHeatStorage instance, EnumFacing side) {
    return new NBTTagInt(instance.getHeatStored());
    //NBTTagCompound tag = new NBTTagCompound();
    //tag.setInteger("enthalpy", instance.getHeatStored());
    //return tag;
}
DefaultHeatStorageSerializer.java 文件源码 项目:Thermionics 阅读 16 收藏 0 点赞 0 评论 0
@Override
public void readNBT(Capability<IHeatStorage> capability, IHeatStorage instance, EnumFacing side, NBTBase nbt) {
    if (nbt instanceof NBTTagCompound) {
        NBTTagCompound tag = (NBTTagCompound)nbt;

        int toReceive = tag.getInteger("enthalpy") - instance.getHeatStored();
        instance.receiveHeat(toReceive, false);
    }

    if (nbt instanceof NBTTagInt) {
        instance.receiveHeat(((NBTTagInt)nbt).getInt(), false);
    }
}
TileEntityMashTun.java 文件源码 项目:Thermionics 阅读 21 收藏 0 点赞 0 评论 0
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagIn) {
    NBTTagCompound tagOut = super.writeToNBT(tagIn);
    tagOut.setTag("inputtank", CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.writeNBT(inputTank, null));
    tagOut.setTag("outputtank", CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY.writeNBT(outputTank, null));
    tagOut.setTag("heatstorage", Thermionics.CAPABILITY_HEATSTORAGE.writeNBT(heat, null));
    tagOut.setTag("inventory", CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.writeNBT(items, null));

    tagOut.setTag("cooldown", new NBTTagInt(cooldown));

    return tagOut;
}
DragonFightManager.java 文件源码 项目:Backmemed 阅读 28 收藏 0 点赞 0 评论 0
public NBTTagCompound getCompound()
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();

    if (this.dragonUniqueId != null)
    {
        nbttagcompound.setUniqueId("DragonUUID", this.dragonUniqueId);
    }

    nbttagcompound.setBoolean("DragonKilled", this.dragonKilled);
    nbttagcompound.setBoolean("PreviouslyKilled", this.previouslyKilled);

    if (this.exitPortalLocation != null)
    {
        nbttagcompound.setTag("ExitPortalLocation", NBTUtil.createPosTag(this.exitPortalLocation));
    }

    NBTTagList nbttaglist = new NBTTagList();
    Iterator iterator = this.gateways.iterator();

    while (iterator.hasNext())
    {
        int i = ((Integer)iterator.next()).intValue();
        nbttaglist.appendTag(new NBTTagInt(i));
    }

    nbttagcompound.setTag("Gateways", nbttaglist);
    return nbttagcompound;
}
Template.java 文件源码 项目:Backmemed 阅读 20 收藏 0 点赞 0 评论 0
private NBTTagList writeInts(int... values)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (int i : values)
    {
        nbttaglist.appendTag(new NBTTagInt(i));
    }

    return nbttaglist;
}
TileEntityUpgrades.java 文件源码 项目:Mods 阅读 16 收藏 0 点赞 0 评论 0
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
    super.writeToNBT(compound);
    NBTTagCompound attrs = new NBTTagCompound();
    NBTTagList attrList = new NBTTagList();
    compound.setTag("Attributes", attrs);
    compound.setTag("AttributesList", attrList);
    for (TF2Attribute attr : this.attributeList)
        if (attr != null) {
            attrList.appendTag(new NBTTagInt(attr.id));
            attrs.setInteger(String.valueOf(attr.id), this.attributes.get(attr));
        }

    return compound;
}
DragonFightManager.java 文件源码 项目:CustomWorldGen 阅读 16 收藏 0 点赞 0 评论 0
public NBTTagCompound getCompound()
{
    NBTTagCompound nbttagcompound = new NBTTagCompound();

    if (this.dragonUniqueId != null)
    {
        nbttagcompound.setUniqueId("DragonUUID", this.dragonUniqueId);
    }

    nbttagcompound.setBoolean("DragonKilled", this.dragonKilled);
    nbttagcompound.setBoolean("PreviouslyKilled", this.previouslyKilled);

    if (this.exitPortalLocation != null)
    {
        nbttagcompound.setTag("ExitPortalLocation", NBTUtil.createPosTag(this.exitPortalLocation));
    }

    NBTTagList nbttaglist = new NBTTagList();
    Iterator iterator = this.gateways.iterator();

    while (iterator.hasNext())
    {
        int i = ((Integer)iterator.next()).intValue();
        nbttaglist.appendTag(new NBTTagInt(i));
    }

    nbttagcompound.setTag("Gateways", nbttaglist);
    return nbttagcompound;
}
Template.java 文件源码 项目:CustomWorldGen 阅读 30 收藏 0 点赞 0 评论 0
private NBTTagList writeInts(int... values)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (int i : values)
    {
        nbttaglist.appendTag(new NBTTagInt(i));
    }

    return nbttaglist;
}


问题


面经


文章

微信
公众号

扫码关注公众号