Java 类net.minecraft.nbt.NBTTagIntArray 实例源码

项目:Mods    文件:EntityMerasmus.java   
@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());

}
项目:Minecraft-Flux    文件:SpecialEventReceiver.java   
@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());
        }
    }
}
项目:Minecraft-Flux    文件:TileEntityFluxGen.java   
@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;
}
项目:TaleCraft    文件:NBTHelper.java   
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;
    }

}
项目:UsefulPets    文件:PetEggItem.java   
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;
}
项目:Easy-Editors    文件:NBTToJson.java   
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);
    }
}
项目:Gadomancy    文件:DataAchromatic.java   
@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();
}
项目:copycore    文件:NbtUtils.java   
/** 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);
}
项目:CraftingManager    文件:ConvertNBTTagCompound.java   
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;
}
项目:NBTEdit    文件:GuiEditNBT.java   
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));
}
项目:NBTEdit    文件:GuiEditNBT.java   
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);
    }
}
项目:runesofwizardry-classics    文件:RuneEntityPowerDistribution.java   
@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);
}
项目:runesofwizardry-classics    文件:RuneEntitySpriteEarth.java   
@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);
}
项目:CrystalMod    文件:BasicCraftingTask.java   
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));
}
项目:Factorization    文件:MemberPos.java   
NBTTagIntArray toArray() {
    int[] ret = new int[4];
    ret[0] = x;
    ret[1] = y;
    ret[2] = z;
    ret[3] = side;
    return new NBTTagIntArray(ret);
}
项目:Factorization    文件:WireLeader.java   
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));
}
项目:NOVA-Core    文件:DataConverter.java   
/**
 * 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;
}
项目:NOVA-Core    文件:DataConverter.java   
/**
 * 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;
}
项目:ARKCraft-Code    文件:TileInventoryCompostBin.java   
@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.");
}
项目:ARKCraft-Code    文件:InventoryTaming.java   
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);
}
项目:UsefulPets    文件:PetEntity.java   
@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() );
}
项目:Easy-Editors    文件:NBTToJson.java   
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(']');
}
项目:Gadomancy    文件:DataAchromatic.java   
@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]));
}
项目:copycore    文件:NbtUtils.java   
/** 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");
}
项目:Runes-of-Wizardry    文件:TileEntityDustActive.java   
@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;
}
项目:PowerAdvantageAPI    文件:BlockPos4D.java   
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);
}
项目:projectzulu1.7.10-pre-1.3a    文件:NBTWriter.java   
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();
    }
}
项目:DynIMC    文件:NBTTagCompoundDeserializer.java   
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);
}
项目:NBTEdit    文件:NBTStringHelper.java   
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;
    }
}
项目:RuneCraftery    文件:ComponentMineshaftRoom.java   
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));
   }

}
项目:RuneCraftery    文件:NBTTagCompound.java   
public int[] func_74759_k(String p_74759_1_) {
   try {
      return !this.field_74784_a.containsKey(p_74759_1_)?new int[0]:((NBTTagIntArray)this.field_74784_a.get(p_74759_1_)).field_74749_a;
   } catch (ClassCastException var3) {
      throw new ReportedException(this.func_82581_a(p_74759_1_, 11, var3));
   }
}
项目:RuneCraftery    文件:NBTBase.java   
public static NBTBase func_74733_a(byte p_74733_0_, String p_74733_1_) {
   switch(p_74733_0_) {
   case 0:
      return new NBTTagEnd();
   case 1:
      return new NBTTagByte(p_74733_1_);
   case 2:
      return new NBTTagShort(p_74733_1_);
   case 3:
      return new NBTTagInt(p_74733_1_);
   case 4:
      return new NBTTagLong(p_74733_1_);
   case 5:
      return new NBTTagFloat(p_74733_1_);
   case 6:
      return new NBTTagDouble(p_74733_1_);
   case 7:
      return new NBTTagByteArray(p_74733_1_);
   case 8:
      return new NBTTagString(p_74733_1_);
   case 9:
      return new NBTTagList(p_74733_1_);
   case 10:
      return new NBTTagCompound(p_74733_1_);
   case 11:
      return new NBTTagIntArray(p_74733_1_);
   default:
      return null;
   }
}
项目:RuneCraftery    文件:ItemFireworkCharge.java   
@SideOnly(Side.CLIENT)
public int func_82790_a(ItemStack p_82790_1_, int p_82790_2_) {
   if(p_82790_2_ != 1) {
      return super.func_82790_a(p_82790_1_, p_82790_2_);
   } else {
      NBTBase var3 = func_92108_a(p_82790_1_, "Colors");
      if(var3 == null) {
         return 9079434;
      } else {
         NBTTagIntArray var4 = (NBTTagIntArray)var3;
         if(var4.field_74749_a.length == 1) {
            return var4.field_74749_a[0];
         } else {
            int var5 = 0;
            int var6 = 0;
            int var7 = 0;
            int[] var8 = var4.field_74749_a;
            int var9 = var8.length;

            for(int var10 = 0; var10 < var9; ++var10) {
               int var11 = var8[var10];
               var5 += (var11 & 16711680) >> 16;
               var6 += (var11 & '\uff00') >> 8;
               var7 += (var11 & 255) >> 0;
            }

            var5 /= var4.field_74749_a.length;
            var6 /= var4.field_74749_a.length;
            var7 /= var4.field_74749_a.length;
            return var5 << 16 | var6 << 8 | var7;
         }
      }
   }
}
项目:RuneCraftery    文件:ComponentMineshaftRoom.java   
protected void func_143011_b(NBTTagCompound par1NBTTagCompound)
{
    NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Entrances");

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        this.roomsLinkedToTheRoom.add(new StructureBoundingBox(((NBTTagIntArray)nbttaglist.tagAt(i)).intArray));
    }
}
项目:FloodLights    文件:TileEntityPhantomLight.java   
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound) {
    nbtTagCompound = super.writeToNBT(nbtTagCompound);
    if (!this.sources.isEmpty()) {
        NBTTagList SourceList = new NBTTagList();
        for (BlockPos source : sources) {
            SourceList.appendTag(new NBTTagIntArray(getIntArrayFromPos(source)));
        }
        nbtTagCompound.setTag(Names.NBT.SOURCES, SourceList);
    }
    return nbtTagCompound;
}
项目:projectzulu1.7.10    文件:NBTWriter.java   
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();
    }
}
项目:SevenCommons    文件:ArrayConversions.java   
private static MethodHandle writeIntArr() {
    if (WR_INT_ARR == null) {
        try {
            WR_INT_ARR = MethodHandles.publicLookup()
                    .findConstructor(NBTTagIntArray.class, methodType(void.class, String.class, int[].class))
                    .bindTo("")
                    .asType(methodType(NBTBase.class, int[].class));
        } catch (ReflectiveOperationException e) {
            throw Throwables.propagate(e);
        }
    }
    return WR_INT_ARR;
}
项目:SevenCommons    文件:ArrayConversions.java   
private static MethodHandle readIntArr() {
    if (RE_INT_ARR == null) {
        try {
            RE_INT_ARR = MethodHandles.publicLookup()
                    .findGetter(NBTTagIntArray.class, MCPNames.field(MCPNames.F_NBT_INT_ARR_DATA), int[].class);
        } catch (ReflectiveOperationException e) {
            throw Throwables.propagate(e);
        }
    }
    return RE_INT_ARR;
}
项目:BetterNutritionMod    文件:ComponentMineshaftRoom.java   
protected void func_143011_b(NBTTagCompound par1NBTTagCompound)
{
    NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Entrances");

    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        this.roomsLinkedToTheRoom.add(new StructureBoundingBox(((NBTTagIntArray)nbttaglist.tagAt(i)).intArray));
    }
}
项目:minecraft-roguelike    文件:Firework.java   
public static ItemStack get(Random rand, int stackSize){

    ItemStack rocket = new ItemStack(Items.FIREWORKS, stackSize);

    NBTTagCompound tag = new NBTTagCompound();
    NBTTagCompound fireworks = new NBTTagCompound();

    fireworks.setByte("Flight", (byte) (rand.nextInt(3) + 1));

    NBTTagList explosion = new NBTTagList();

    NBTTagCompound properties = new NBTTagCompound();
    properties.setByte("Flicker", (byte) (rand.nextBoolean() ? 1 : 0));
    properties.setByte("Trail", (byte) (rand.nextBoolean() ? 1 : 0));
    properties.setByte("Type", (byte) (rand.nextInt(5)));

    int size = rand.nextInt(4) + 1;
    int[] colorArr = new int[size];
    for(int i = 0; i < size; ++i){
        colorArr[i] = DyeColor.HSLToColor(rand.nextFloat(), (float)1.0, (float)0.5);
    }

    NBTTagIntArray colors = new NBTTagIntArray(colorArr);
    properties.setTag("Colors", colors);

    explosion.appendTag(properties);
    fireworks.setTag("Explosions", explosion);
    tag.setTag("Fireworks", fireworks);

    rocket.setTagCompound(tag);

    return rocket;
}