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

EntityMerasmus.java 文件源码 项目:Mods 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
    super.writeEntityToNBT(nbt);
    nbt.setBoolean("Hidden", this.hidden);
    if(hidden){
        nbt.setIntArray("HiddenPos", new int[]{this.hiddenBlock.getX(),this.hiddenBlock.getY(),this.hiddenBlock.getZ()});
        NBTTagList list=new NBTTagList();
        nbt.setTag("Props", list);
        for(BlockPos pos:this.usedPos)
            list.appendTag(new NBTTagIntArray(new int[]{pos.getX(),pos.getY(),pos.getZ()}));
    }
    nbt.setShort("Begin", (short)this.begin);
    nbt.setShort("Teleport", (short)this.teleportCooldown);
    nbt.setShort("BombCooldown", (short)this.bombCooldown);
    nbt.setShort("BombDuration", (short)this.bombDuration);
    nbt.setShort("TopBlock", (short)this.topBlock);
    nbt.setByte("HideCount", (byte)this.hideCount);
    nbt.setBoolean("Bomb", this.isBombSpell());

}
SpecialEventReceiver.java 文件源码 项目:Minecraft-Flux 阅读 20 收藏 0 点赞 0 评论 0
@Override public void deserializeNBT(NBTBase nbt) {
    if (nbt == null)
        return;
    // NEW NBT DESERIALIZING
    if (nbt instanceof NBTTagIntArray) {
        int[] ia = ((NBTTagIntArray) nbt).getIntArray();
        for (int i : ia)
            received.add(i);
    }
    // OLD NBT DESERIALIZING
    else if (nbt instanceof NBTTagList) {
        NBTTagList nbtl = (NBTTagList) nbt;
        for (int i = 0; i < nbtl.tagCount(); i++) {
            NBTBase nb = nbtl.get(i);
            if (nb instanceof NBTPrimitive)
                received.add(((NBTPrimitive) nb).getInt());
        }
    }
}
TileEntityFluxGen.java 文件源码 项目:Minecraft-Flux 阅读 16 收藏 0 点赞 0 评论 0
@Nonnull @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
    super.writeToNBT(nbt);
    nbt.setInteger("E", (int) energy);
    NBTTagList nbtl = new NBTTagList();
    for (byte i = 0; i < items.length; i++) {
        if (items[i].isEmpty())
            continue;
        NBTTagCompound inbt = new NBTTagCompound();
        inbt.setByte("Slot", i);
        nbtl.appendTag(items[i].writeToNBT(inbt));
    }
    nbt.setTag("Items", nbtl);
    nbtl = new NBTTagList();
    for (byte i = 0; i < tanks.length; i++) {
        if (tanks[i].fluid == null || tanks[i].fluid.amount == 0)
            continue;
        NBTTagCompound fnbt = new NBTTagCompound();
        fnbt.setByte("Slot", i);
        nbtl.appendTag(tanks[i].fluid.writeToNBT(fnbt));
    }
    nbt.setTag("Fluids", nbtl);
    int[] v = new int[vals.length];
    System.arraycopy(vals, 0, v, 0, vals.length);
    nbt.setTag("Vals", new NBTTagIntArray(v));
    return nbt;
}
NBTHelper.java 文件源码 项目:TaleCraft 阅读 22 收藏 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;
    }

}
PetEggItem.java 文件源码 项目:UsefulPets 阅读 39 收藏 0 点赞 0 评论 0
public ItemStack getPetEgg( String petType )
{
    PetType type = PetType.forName( petType );
    int[] skills = new int[ type.defaultSkills.size() ];
    for ( int i = 0; i < skills.length; ++i )
    {
        skills[ i ] = type.defaultSkills.get( i );
    }

    NBTTagCompound petTag = new NBTTagCompound();

    petTag.setString( "Type", type.name );
    petTag.setInteger( "Level", 1 );
    petTag.setInteger( "FreeSkillPoints", 1 );
    petTag.setTag( "Skills", new NBTTagIntArray( skills ) );
    petTag.setFloat( "Hunger", PetEntity.MAX_HUNGER );

    ItemStack stack = new ItemStack( this );
    NBTTagCompound tag = new NBTTagCompound();
    tag.setTag( "Pet", petTag );
    stack.setTagCompound( tag );

    return stack;
}
NBTToJson.java 文件源码 项目:Easy-Editors 阅读 25 收藏 0 点赞 0 评论 0
private static StringBuilder any(StringBuilder sb, NBTBase nbt) {
    switch (nbt.getId()) {
    case Constants.NBT.TAG_COMPOUND:
        return compound(sb, (NBTTagCompound) nbt);
    case Constants.NBT.TAG_LIST:
        return list(sb, (NBTTagList) nbt);
    case Constants.NBT.TAG_INT_ARRAY:
        return intArray(sb, (NBTTagIntArray) nbt);
    case Constants.NBT.TAG_STRING:
        return string(sb, (NBTTagString) nbt);
    case Constants.NBT.TAG_DOUBLE:
        return _double(sb, (NBTTagDouble) nbt);
    case Constants.NBT.TAG_FLOAT:
        return _float(sb, (NBTTagFloat) nbt);
    default:
        return other(sb, nbt);
    }
}
DataAchromatic.java 文件源码 项目:Gadomancy 阅读 26 收藏 0 点赞 0 评论 0
@Override
public void writeToPacket(NBTTagCompound compound) {
    int[] array = new int[removeClientQueue.size()];
    for (int i = 0; i < removeClientQueue.size(); i++) {
        array[i] = removeClientQueue.get(i);
    }
    compound.setTag("removals", new NBTTagIntArray(array));
    array = new int[addClientQueue.size()];
    for (int i = 0; i < addClientQueue.size(); i++) {
        array[i] = addClientQueue.get(i);
    }
    compound.setTag("additions", new NBTTagIntArray(array));

    removeClientQueue.clear();
    addClientQueue.clear();
}
NbtUtils.java 文件源码 项目:copycore 阅读 24 收藏 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 阅读 22 收藏 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 阅读 21 收藏 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));
}
GuiEditNBT.java 文件源码 项目:NBTEdit 阅读 22 收藏 0 点赞 0 评论 0
private static String getValue(NBTBase base){
    switch(base.getId()){
    case 7:
        String s = "";
        for (byte b : ((NBTTagByteArray)base).func_150292_c() /*byteArray*/){
            s += b + " ";
        }
        return s;
    case 9:
        return "TagList";
    case 10:
        return "TagCompound";
    case 11:
        String i = "";
        for (int a : ((NBTTagIntArray)base).func_150302_c() /*intArray*/){
            i += a + " ";
        }
        return i;
    default: 
        return NBTStringHelper.toString(base);
    }
}
RuneEntityPowerDistribution.java 文件源码 项目:runesofwizardry-classics 阅读 16 收藏 0 点赞 0 评论 0
@Override
public void writeToNBT(NBTTagCompound compound) {
    super.writeToNBT(compound);
    NBTTagList runes = new NBTTagList();
    for(FueledRuneEntity ent:poweredRunes){
        BlockPos pos = ent.getPos();
        NBTTagIntArray coords = new NBTTagIntArray(new int[]{pos.getX(),pos.getY(),pos.getZ()});
        runes.appendTag(coords);
    }
    compound.setTag("PoweredRunes", runes);
}
RuneEntitySpriteEarth.java 文件源码 项目:runesofwizardry-classics 阅读 21 收藏 0 点赞 0 评论 0
@Override
public void writeToNBT(NBTTagCompound compound) {
    super.writeToNBT(compound);
    compound.setString("player", activatingPlayer);
    compound.setBoolean("protecting", wasProtecting);
    NBTTagList pos = new NBTTagList();
    if(box!=null){
        for(BlockPos p:box){
            pos.appendTag(new NBTTagIntArray(new int[]{p.getX(),p.getY(),p.getZ()}));
        }
    }
    compound.setTag("boxPositions", pos);
}
BasicCraftingTask.java 文件源码 项目:CrystalMod 阅读 17 收藏 0 点赞 0 评论 0
public static void writeBooleanArray(NBTTagCompound tag, String name, boolean[] array) {
    int[] intArray = new int[array.length];

    for (int i = 0; i < intArray.length; ++i) {
        intArray[i] = array[i] ? 1 : 0;
    }

    tag.setTag(name, new NBTTagIntArray(intArray));
}
MemberPos.java 文件源码 项目:Factorization 阅读 16 收藏 0 点赞 0 评论 0
NBTTagIntArray toArray() {
    int[] ret = new int[4];
    ret[0] = x;
    ret[1] = y;
    ret[2] = z;
    ret[3] = side;
    return new NBTTagIntArray(ret);
}
WireLeader.java 文件源码 项目:Factorization 阅读 15 收藏 0 点赞 0 评论 0
private static void writeCollection(NBTTagCompound out, String key, Collection<MemberPos> list) {
    int[] data = new int[4 * list.size()];
    int i = 0;
    for (MemberPos member : list) {
        data[i++] = member.x;
        data[i++] = member.y;
        data[i++] = member.z;
        data[i++] = member.side;
    }
    out.setTag(key, new NBTTagIntArray(data));
}
DataConverter.java 文件源码 项目:NOVA-Core 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Reads an unknown object withPriority a known name from NBT
 * @param tag - tag to read the value from
 * @param key - name of the value
 * @return object or suggestionValue if nothing is found
 */
public Object load(NBTTagCompound tag, String key) {
    if (tag != null && key != null) {
        NBTBase saveTag = tag.getTag(key);

        if (saveTag instanceof NBTTagFloat) {
            return tag.getFloat(key);
        } else if (saveTag instanceof NBTTagDouble) {
            return tag.getDouble(key);
        } else if (saveTag instanceof NBTTagInt) {
            return tag.getInteger(key);
        } else if (saveTag instanceof NBTTagString) {
            if (tag.getBoolean(key + "::nova.isBigInteger")) {
                return new BigInteger(tag.getString(key));
            } else if (tag.getBoolean(key + "::nova.isBigDecimal")) {
                return new BigDecimal(tag.getString(key));
            } else {
                return tag.getString(key);
            }
        } else if (saveTag instanceof NBTTagShort) {
            return tag.getShort(key);
        } else if (saveTag instanceof NBTTagByte) {
            if (tag.getBoolean(key + "::nova.isBoolean")) {
                return tag.getBoolean(key);
            } else {
                return tag.getByte(key);
            }
        } else if (saveTag instanceof NBTTagLong) {
            return tag.getLong(key);
        } else if (saveTag instanceof NBTTagByteArray) {
            return tag.getByteArray(key);
        } else if (saveTag instanceof NBTTagIntArray) {
            return tag.getIntArray(key);
        } else if (saveTag instanceof NBTTagCompound) {
            NBTTagCompound innerTag = tag.getCompoundTag(key);
            return toNova(innerTag);
        }
    }
    return null;
}
DataConverter.java 文件源码 项目:NOVA-Core 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Reads an unknown object withPriority a known name from NBT
 * @param tag - tag to read the value from
 * @param key - name of the value
 * @return object or suggestionValue if nothing is found
 */
public Object load(NBTTagCompound tag, String key) {
    if (tag != null && key != null) {
        NBTBase saveTag = tag.getTag(key);

        if (saveTag instanceof NBTTagFloat) {
            return tag.getFloat(key);
        } else if (saveTag instanceof NBTTagDouble) {
            return tag.getDouble(key);
        } else if (saveTag instanceof NBTTagInt) {
            return tag.getInteger(key);
        } else if (saveTag instanceof NBTTagString) {
            if (tag.getBoolean(key + "::nova.isBigInteger")) {
                return new BigInteger(tag.getString(key));
            } else if (tag.getBoolean(key + "::nova.isBigDecimal")) {
                return new BigDecimal(tag.getString(key));
            } else {
                return tag.getString(key);
            }
        } else if (saveTag instanceof NBTTagShort) {
            return tag.getShort(key);
        } else if (saveTag instanceof NBTTagByte) {
            if (tag.getBoolean(key + "::nova.isBoolean")) {
                return tag.getBoolean(key);
            } else {
                return tag.getByte(key);
            }
        } else if (saveTag instanceof NBTTagLong) {
            return tag.getLong(key);
        } else if (saveTag instanceof NBTTagByteArray) {
            return tag.getByteArray(key);
        } else if (saveTag instanceof NBTTagIntArray) {
            return tag.getIntArray(key);
        } else if (saveTag instanceof NBTTagCompound) {
            NBTTagCompound innerTag = tag.getCompoundTag(key);
            return toNova(innerTag);
        }
    }
    return null;
}
TileInventoryCompostBin.java 文件源码 项目:ARKCraft-Code 阅读 16 收藏 0 点赞 0 评论 0
@Override
public void writeToNBT(NBTTagCompound parentNBTTagCompound)
{
    super.writeToNBT(parentNBTTagCompound); // The super call is required to
                                            // save and load the tiles
                                            // location

    // Save the stored item stacks

    // to use an analogy with Java, this code generates an array of hashmaps
    // The itemStack in each slot is converted to an NBTTagCompound, which
    // is effectively a hashmap of key->value pairs such
    // as slot=1, id=2353, count=1, etc
    // Each of these NBTTagCompound are then inserted into NBTTagList, which
    // is similar to an array.
    NBTTagList dataForAllSlots = new NBTTagList();
    for (int i = 0; i < this.itemStacks.length; ++i)
    {
        if (this.itemStacks[i] != null)
        {
            NBTTagCompound dataForThisSlot = new NBTTagCompound();
            dataForThisSlot.setByte("Slot", (byte) i);
            this.itemStacks[i].writeToNBT(dataForThisSlot);
            dataForAllSlots.appendTag(dataForThisSlot);
        }
    }
    // the array of hashmaps is then inserted into the parent hashmap for
    // the container
    parentNBTTagCompound.setTag("Items", dataForAllSlots);

    // Save everything else
    parentNBTTagCompound.setShort("compostTime", compostTime);
    parentNBTTagCompound.setTag("compostTimeRemaining",
            new NBTTagIntArray(compostTimeRemaining));
    LogHelper.info("TileInventoryCompostBin: Wrote inventory.");
}
InventoryTaming.java 文件源码 项目:ARKCraft-Code 阅读 20 收藏 0 点赞 0 评论 0
public void saveInventoryToNBT(NBTTagCompound parentNBTTagCompound)
{
    // to use an analogy with Java, this code generates an array of hashmaps
    // The itemStack in each slot is converted to an NBTTagCompound, which
    // is effectively a hashmap of key->value pairs such
    // as slot=1, id=2353, count=1, etc
    // Each of these NBTTagCompound are then inserted into NBTTagList, which
    // is similar to an array.
    NBTTagList dataForAllSlots = new NBTTagList();
    for (int i = 0; i < this.itemStacks.length; ++i)
    {
        if (this.itemStacks[i] != null)
        {
            NBTTagCompound dataForThisSlot = new NBTTagCompound();
            dataForThisSlot.setByte("Slot", (byte) i);
            this.itemStacks[i].writeToNBT(dataForThisSlot);
            dataForAllSlots.appendTag(dataForThisSlot);
        }
    }
    // the array of hashmaps is then inserted into the parent hashmap for
    // the container
    parentNBTTagCompound.setTag("Items", dataForAllSlots);

    // Save everything else
    parentNBTTagCompound.setTag("burnTimeRemaining", new NBTTagIntArray(feedingTimeRemaining));
    parentNBTTagCompound.setTag("burnTimeInitial", new NBTTagIntArray(feedingTimeInitialValue));
    parentNBTTagCompound.setShort("tamingTime", tamingTime);
    parentNBTTagCompound.setShort("torporTime", torporTime);
}
PetEntity.java 文件源码 项目:UsefulPets 阅读 22 收藏 0 点赞 0 评论 0
@Override
public void writeEntityToNBT( NBTTagCompound tag)
{
    super.writeEntityToNBT( tag );

    tag.setString( "OwnerID", func_152113_b() );
    tag.setString( "Type", getPetType().name );
    tag.setInteger( "Level", getLevel() );
    tag.setInteger( "FreeSkillPoints", getFreeSkillPoints() );
    int[] theSkills = new int[ skills.size() ];
    for ( int i = 0; i < skills.size(); ++i )
    {
        theSkills[ i ] = skills.get( i );
    }
    tag.setTag( "Skills", new NBTTagIntArray( theSkills ) );
    {
        NBTTagList list = new NBTTagList();
        for ( int i = 0; i < 12; ++i )
        {
            ItemStack stack = inv.getStackInSlot( i );

            NBTTagCompound compound = new NBTTagCompound();
            if ( stack != null )
            {
                stack.writeToNBT( compound );
            }

            list.appendTag( compound );
        }
        tag.setTag( "Inventory", list );
    }

    tag.setBoolean( "Sitting", isSitting() );
    tag.setFloat( "Hunger", getHunger() );
    tag.setFloat( "Saturation", getSaturation() );
    tag.setString( "Texture", getTexture() );
}
NBTToJson.java 文件源码 项目:Easy-Editors 阅读 22 收藏 0 点赞 0 评论 0
private static StringBuilder intArray(StringBuilder sb, NBTTagIntArray arr) {
    sb.append('[');
    int[] is = arr.getIntArray();
    if (is.length != 0) {
        sb.append(is[0]);
    }
    for (int i = 1; i < is.length; i++) {
        sb.append(',').append(is[i]);
    }
    return sb.append(']');
}
DataAchromatic.java 文件源码 项目:Gadomancy 阅读 17 收藏 0 点赞 0 评论 0
@Override
public void writeAllDataToPacket(NBTTagCompound compound) {
    int[] array = new int[achromaticEntities.size()];
    for (int i = 0; i < achromaticEntities.size(); i++) {
        array[i] = achromaticEntities.get(i);
    }
    compound.setTag("additions", new NBTTagIntArray(array));
    compound.setTag("removals", new NBTTagIntArray(new int[0]));
}
NbtUtils.java 文件源码 项目:copycore 阅读 31 收藏 0 点赞 0 评论 0
/** Returns the primitive value of a tag, casted to the return type. */
public static <T> T getTagValue(NBTBase tag) {
    if (tag == null)
        throw new IllegalArgumentException("tag is null");
    if (tag instanceof NBTTagByte)      return (T)(Object)((NBTTagByte)tag).func_150290_f();
    if (tag instanceof NBTTagShort)     return (T)(Object)((NBTTagShort)tag).func_150289_e();
    if (tag instanceof NBTTagInt)       return (T)(Object)((NBTTagInt)tag).func_150287_d();
    if (tag instanceof NBTTagLong)      return (T)(Object)((NBTTagLong)tag).func_150291_c();
    if (tag instanceof NBTTagFloat)     return (T)(Object)((NBTTagFloat)tag).func_150288_h();
    if (tag instanceof NBTTagDouble)    return (T)(Object)((NBTTagDouble)tag).func_150286_g();
    if (tag instanceof NBTTagString)    return (T)((NBTTagString)tag).func_150285_a_();
    if (tag instanceof NBTTagByteArray) return (T)((NBTTagByteArray)tag).func_150292_c();
    if (tag instanceof NBTTagIntArray)  return (T)((NBTTagIntArray)tag).func_150302_c();
    throw new IllegalArgumentException(NBTBase.NBTTypes[tag.getId()] + " isn't a primitive NBT tag");
}
TileEntityDustActive.java 文件源码 项目:Runes-of-Wizardry 阅读 20 收藏 0 点赞 0 评论 0
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
    super.writeToNBT(tagCompound);
    if(rune!=null){
        rune.writeToNBT(tagCompound);
        tagCompound.setString("runeID", DustRegistry.getRuneID(rune.creator));
        //write the rune's blockpos set
        NBTTagList positions = new NBTTagList();
        for(BlockPos p: rune.dustPositions){
            NBTTagIntArray current = new NBTTagIntArray(new int[]{p.getX(),p.getY(),p.getZ()});
            positions.appendTag(current);
        }
        tagCompound.setTag("dustPositions",positions);
        //write the rune's ItemStacks
        NBTTagList itemList = new NBTTagList();
        for (int r = 0; r < rune.placedPattern.length; r++) {
            for(int c=0;c<rune.placedPattern[r].length;c++){
                ItemStack stack = rune.placedPattern[r][c];
                NBTTagCompound tag = new NBTTagCompound();
                if (!stack.isEmpty()) {
                    stack.writeToNBT(tag);
                    tag.setInteger("Row", r);
                    tag.setInteger("Col", c);
                    itemList.appendTag(tag);
                }
            }
        }
        tagCompound.setTag("Pattern", itemList);
        tagCompound.setTag("Facing", new NBTTagString(rune.face.getName()));
        tagCompound.setBoolean("renderActive", rune.renderActive);
    }
    tagCompound.setLong("ticksExisted", ticksExisted);
    if(stardata!=null)tagCompound.setTag("star", stardata.writeNBT(new NBTTagCompound()));
    if(beamdata!=null)tagCompound.setTag("beam", beamdata.writeNBT(new NBTTagCompound()));
    return tagCompound;
}
BlockPos4D.java 文件源码 项目:PowerAdvantageAPI 阅读 15 收藏 0 点赞 0 评论 0
public NBTBase toNBT() {
    int[] data = new int[4];
    data[0] = dimension;
    data[1] = pos.getX();
    data[2] = pos.getY();
    data[3] = pos.getZ();
    return new NBTTagIntArray(data);
}
NBTWriter.java 文件源码 项目:projectzulu1.7.10-pre-1.3a 阅读 25 收藏 0 点赞 0 评论 0
private static NBTBase createChildTag(byte childtag, String... values) {
    switch (childtag) {
    /* Container Tags */
    case 9:
        return new NBTTagList();
    case 10:
        return new NBTTagCompound();
        /* Value Tags: operations[2] should contain value */
    case 1:
        return new NBTTagByte(Byte.parseByte(values[0].trim()));
    case 2:
        return new NBTTagShort(Short.parseShort(values[0].trim()));
    case 3:
        return new NBTTagInt(Integer.parseInt(values[0].trim()));
    case 4:
        return new NBTTagLong(Long.parseLong(values[0].trim()));
    case 5:
        return new NBTTagFloat(Float.parseFloat(values[0].trim()));
    case 6:
        return new NBTTagDouble(Double.parseDouble(values[0].trim()));
    case 7:
        byte[] byteArray = new byte[values.length];
        for (int i = 2; i < values.length; i++) {
            byteArray[i - 2] = (byte) ParsingHelper.parseFilteredInteger(values[i], 0, "ByteArray");
        }
        return new NBTTagByteArray(byteArray);
    case 8:
        return new NBTTagString("");
    case 11:
        int[] intArray = new int[values.length - 2];
        for (int i = 2; i < values.length; i++) {
            intArray[i - 2] = (int) ParsingHelper.parseFilteredInteger(values[i], 0, "ByteArray");
        }
        return new NBTTagIntArray(intArray);
    default:
        ProjectZuluLog.severe("Unrecognised childtag tagId %s", childtag);
        throw new IllegalArgumentException();
    }
}
NBTTagCompoundDeserializer.java 文件源码 项目:DynIMC 阅读 20 收藏 0 点赞 0 评论 0
private NBTTagIntArray getIntArray(JsonArray jsonArray) {
    int[] intArray = new int[jsonArray.size()];

    for (int i = 0; i < jsonArray.size(); i++) {
        final JsonElement element = jsonArray.get(i);
        final String str = element.getAsString();
        intArray[i] = str.startsWith("0x") ? Integer.parseInt(str.substring(2), 0x10) : element.getAsInt();
    }

    return new NBTTagIntArray(intArray);
}
NBTStringHelper.java 文件源码 项目:NBTEdit 阅读 22 收藏 0 点赞 0 评论 0
public static NBTBase newTag(byte type){
    switch (type)
    {
    case 0:
        return new NBTTagEnd();
    case 1:
        return new NBTTagByte((byte) 0);
    case 2:
        return new NBTTagShort();
    case 3:
        return new NBTTagInt(0);
    case 4:
        return new NBTTagLong(0);
    case 5:
        return new NBTTagFloat(0);
    case 6:
        return new NBTTagDouble(0);
    case 7:
        return new NBTTagByteArray(new byte[0]);
    case 8:
        return new NBTTagString("");
    case 9:
        return new NBTTagList();
    case 10:
        return new NBTTagCompound();
    case 11:
        return new NBTTagIntArray(new int[0]);
    default:
        return null;
    }
}
ComponentMineshaftRoom.java 文件源码 项目:RuneCraftery 阅读 24 收藏 0 点赞 0 评论 0
protected void func_143011_b(NBTTagCompound p_143011_1_) {
   NBTTagList var2 = p_143011_1_.func_74761_m("Entrances");

   for(int var3 = 0; var3 < var2.func_74745_c(); ++var3) {
      this.field_74949_a.add(new StructureBoundingBox(((NBTTagIntArray)var2.func_74743_b(var3)).field_74749_a));
   }

}


问题


面经


文章

微信
公众号

扫码关注公众号