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

ItemElectricBase.java 文件源码 项目:4Space-5 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Gets the energy stored in the item. Energy is stored using item NBT
 */
@Override
public float getElectricityStored(ItemStack itemStack)
{
    if (itemStack.getTagCompound() == null)
    {
        itemStack.setTagCompound(new NBTTagCompound());
    }
    float energyStored = 0f;
    if (itemStack.getTagCompound().hasKey("electricity"))
    {
        NBTBase obj = itemStack.getTagCompound().getTag("electricity");
        if (obj instanceof NBTTagDouble)
        {
            energyStored = ((NBTTagDouble) obj).func_150288_h();
        }
        else if (obj instanceof NBTTagFloat)
        {
            energyStored = ((NBTTagFloat) obj).func_150288_h();
        }
    }

    /** Sets the damage as a percentage to render the bar properly. */
    itemStack.setItemDamage((int) (100 - energyStored / this.getMaxElectricityStored(itemStack) * 100));
    return energyStored;
}
NBTHelper.java 文件源码 项目:TaleCraft 阅读 21 收藏 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;
    }

}
NBTToJson.java 文件源码 项目:Easy-Editors 阅读 21 收藏 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);
    }
}
NbtUtils.java 文件源码 项目:copycore 阅读 37 收藏 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 阅读 19 收藏 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));
}
EntityFireball.java 文件源码 项目:RuneCraftery 阅读 21 收藏 0 点赞 0 评论 0
public void func_70037_a(NBTTagCompound p_70037_1_) {
   this.field_70231_e = p_70037_1_.func_74765_d("xTile");
   this.field_70228_f = p_70037_1_.func_74765_d("yTile");
   this.field_70229_g = p_70037_1_.func_74765_d("zTile");
   this.field_70237_h = p_70037_1_.func_74771_c("inTile") & 255;
   this.field_70238_i = p_70037_1_.func_74771_c("inGround") == 1;
   if(p_70037_1_.func_74764_b("direction")) {
      NBTTagList var2 = p_70037_1_.func_74761_m("direction");
      this.field_70159_w = ((NBTTagDouble)var2.func_74743_b(0)).field_74755_a;
      this.field_70181_x = ((NBTTagDouble)var2.func_74743_b(1)).field_74755_a;
      this.field_70179_y = ((NBTTagDouble)var2.func_74743_b(2)).field_74755_a;
   } else {
      this.func_70106_y();
   }

}
EntityFireball.java 文件源码 项目:RuneCraftery 阅读 26 收藏 0 点赞 0 评论 0
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
    this.xTile = par1NBTTagCompound.getShort("xTile");
    this.yTile = par1NBTTagCompound.getShort("yTile");
    this.zTile = par1NBTTagCompound.getShort("zTile");
    this.inTile = par1NBTTagCompound.getByte("inTile") & 255;
    this.inGround = par1NBTTagCompound.getByte("inGround") == 1;

    if (par1NBTTagCompound.hasKey("direction"))
    {
        NBTTagList nbttaglist = par1NBTTagCompound.getTagList("direction");
        this.motionX = ((NBTTagDouble)nbttaglist.tagAt(0)).data;
        this.motionY = ((NBTTagDouble)nbttaglist.tagAt(1)).data;
        this.motionZ = ((NBTTagDouble)nbttaglist.tagAt(2)).data;
    }
    else
    {
        this.setDead();
    }
}
EntityFireball.java 文件源码 项目:BetterNutritionMod 阅读 25 收藏 0 点赞 0 评论 0
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
    this.xTile = par1NBTTagCompound.getShort("xTile");
    this.yTile = par1NBTTagCompound.getShort("yTile");
    this.zTile = par1NBTTagCompound.getShort("zTile");
    this.inTile = par1NBTTagCompound.getByte("inTile") & 255;
    this.inGround = par1NBTTagCompound.getByte("inGround") == 1;

    if (par1NBTTagCompound.hasKey("direction"))
    {
        NBTTagList nbttaglist = par1NBTTagCompound.getTagList("direction");
        this.motionX = ((NBTTagDouble)nbttaglist.tagAt(0)).data;
        this.motionY = ((NBTTagDouble)nbttaglist.tagAt(1)).data;
        this.motionZ = ((NBTTagDouble)nbttaglist.tagAt(2)).data;
    }
    else
    {
        this.setDead();
    }
}
ItemElectric.java 文件源码 项目:4-Space-Legacy 阅读 20 收藏 0 点赞 0 评论 0
/** Gets the energy stored in the item. Energy is stored using item NBT */
@Override
public float getElectricityStored(ItemStack itemStack)
{
    if (itemStack.getTagCompound() == null)
    {
        itemStack.setTagCompound(new NBTTagCompound());
    }
    float energyStored = 0f;
    if (itemStack.getTagCompound().hasKey("electricity"))
    {
        NBTBase obj = itemStack.getTagCompound().getTag("electricity");
        if (obj instanceof NBTTagDouble)
        {
            energyStored = (float) ((NBTTagDouble) obj).data;
        }
        else if (obj instanceof NBTTagFloat)
        {
            energyStored = ((NBTTagFloat) obj).data;
        }
    }

    /** Sets the damage as a percentage to render the bar properly. */
    itemStack.setItemDamage((int) (100 - (energyStored / this.getMaxElectricityStored(itemStack)) * 100));
    return energyStored;
}
AbstractTargetSpell.java 文件源码 项目:spellbound 阅读 17 收藏 0 点赞 0 评论 0
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{
    this.xTile = par1NBTTagCompound.getShort("xTile");
    this.yTile = par1NBTTagCompound.getShort("yTile");
    this.zTile = par1NBTTagCompound.getShort("zTile");
    this.inTile = par1NBTTagCompound.getByte("inTile") & 255;
    this.inGround = par1NBTTagCompound.getByte("inGround") == 1;

    if (par1NBTTagCompound.hasKey("direction"))
    {
        NBTTagList nbttaglist = par1NBTTagCompound.getTagList("direction");
        this.motionX = ((NBTTagDouble)nbttaglist.tagAt(0)).data;
        this.motionY = ((NBTTagDouble)nbttaglist.tagAt(1)).data;
        this.motionZ = ((NBTTagDouble)nbttaglist.tagAt(2)).data;
    }
    else
    {
        this.setDead();
    }
}
ItemElectric.java 文件源码 项目:SimpleTransmutations 阅读 81 收藏 0 点赞 0 评论 0
/** Gets the energy stored in the item. Energy is stored using item NBT */
@Override
public float getElectricityStored(ItemStack itemStack)
{
    if (itemStack.getTagCompound() == null)
    {
        itemStack.setTagCompound(new NBTTagCompound());
    }
    float energyStored = 0f;
    if (itemStack.getTagCompound().hasKey("electricity"))
    {
        NBTBase obj = itemStack.getTagCompound().getTag("electricity");
        if (obj instanceof NBTTagDouble)
        {
            energyStored = (float) ((NBTTagDouble) obj).data;
        }
        else if (obj instanceof NBTTagFloat)
        {
            energyStored = ((NBTTagFloat) obj).data;
        }
    }

    /** Sets the damage as a percentage to render the bar properly. */
    itemStack.setItemDamage((int) (100 - (energyStored / getMaxElectricityStored(itemStack)) * 100));
    return energyStored;
}
HarshenTemplate.java 文件源码 项目:harshencastle 阅读 19 收藏 0 点赞 0 评论 0
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
    for (Template.EntityInfo template$entityinfo : this.entities)
    {
        BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);

        if (aabb == null || aabb.isVecInside(blockpos))
        {
            NBTTagCompound nbttagcompound = template$entityinfo.entityData;
            Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
            Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
            NBTTagList nbttaglist = new NBTTagList();
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.x));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.y));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.z));
            nbttagcompound.setTag("Pos", nbttaglist);
            nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
            Entity entity;

            try
            {
                entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
            }
            catch (Exception var15)
            {
                entity = null;
            }

            if (entity != null)
            {
                float f = entity.getMirroredYaw(mirrorIn);
                f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
                entity.setLocationAndAngles(vec3d1.x, vec3d1.y, vec3d1.z, f, entity.rotationPitch);
                worldIn.spawnEntity(entity);
            }
        }
    }
}
HarshenTemplate.java 文件源码 项目:harshencastle 阅读 20 收藏 0 点赞 0 评论 0
private NBTTagList writeDoubles(double... values)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (double d0 : values)
    {
        nbttaglist.appendTag(new NBTTagDouble(d0));
    }

    return nbttaglist;
}
Entity.java 文件源码 项目:DecompiledMinecraft 阅读 22 收藏 0 点赞 0 评论 0
/**
 * creates a NBT list from the array of doubles passed to this function
 */
protected NBTTagList newDoubleNBTList(double... numbers)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (double d0 : numbers)
    {
        nbttaglist.appendTag(new NBTTagDouble(d0));
    }

    return nbttaglist;
}
Entity.java 文件源码 项目:DecompiledMinecraft 阅读 21 收藏 0 点赞 0 评论 0
/**
 * creates a NBT list from the array of doubles passed to this function
 */
protected NBTTagList newDoubleNBTList(double... numbers)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (double d0 : numbers)
    {
        nbttaglist.appendTag(new NBTTagDouble(d0));
    }

    return nbttaglist;
}
Entity.java 文件源码 项目:BaseClient 阅读 23 收藏 0 点赞 0 评论 0
/**
 * creates a NBT list from the array of doubles passed to this function
 */
protected NBTTagList newDoubleNBTList(double... numbers)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (double d0 : numbers)
    {
        nbttaglist.appendTag(new NBTTagDouble(d0));
    }

    return nbttaglist;
}
Entity.java 文件源码 项目:BaseClient 阅读 19 收藏 0 点赞 0 评论 0
/**
 * creates a NBT list from the array of doubles passed to this function
 */
protected NBTTagList newDoubleNBTList(double... numbers)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (double d0 : numbers)
    {
        nbttaglist.appendTag(new NBTTagDouble(d0));
    }

    return nbttaglist;
}
Template.java 文件源码 项目:Backmemed 阅读 28 收藏 0 点赞 0 评论 0
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
    for (Template.EntityInfo template$entityinfo : this.entities)
    {
        BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);

        if (aabb == null || aabb.isVecInside(blockpos))
        {
            NBTTagCompound nbttagcompound = template$entityinfo.entityData;
            Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
            Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
            NBTTagList nbttaglist = new NBTTagList();
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.xCoord));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.yCoord));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.zCoord));
            nbttagcompound.setTag("Pos", nbttaglist);
            nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
            Entity entity;

            try
            {
                entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
            }
            catch (Exception var15)
            {
                entity = null;
            }

            if (entity != null)
            {
                float f = entity.getMirroredYaw(mirrorIn);
                f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
                entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, f, entity.rotationPitch);
                worldIn.spawnEntityInWorld(entity);
            }
        }
    }
}
Template.java 文件源码 项目:Backmemed 阅读 23 收藏 0 点赞 0 评论 0
private NBTTagList writeDoubles(double... values)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (double d0 : values)
    {
        nbttaglist.appendTag(new NBTTagDouble(d0));
    }

    return nbttaglist;
}
Entity.java 文件源码 项目:Backmemed 阅读 17 收藏 0 点赞 0 评论 0
/**
 * creates a NBT list from the array of doubles passed to this function
 */
protected NBTTagList newDoubleNBTList(double... numbers)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (double d0 : numbers)
    {
        nbttaglist.appendTag(new NBTTagDouble(d0));
    }

    return nbttaglist;
}
Template.java 文件源码 项目:CustomWorldGen 阅读 27 收藏 0 点赞 0 评论 0
private void addEntitiesToWorld(World worldIn, BlockPos pos, Mirror mirrorIn, Rotation rotationIn, @Nullable StructureBoundingBox aabb)
{
    for (Template.EntityInfo template$entityinfo : this.entities)
    {
        BlockPos blockpos = transformedBlockPos(template$entityinfo.blockPos, mirrorIn, rotationIn).add(pos);

        if (aabb == null || aabb.isVecInside(blockpos))
        {
            NBTTagCompound nbttagcompound = template$entityinfo.entityData;
            Vec3d vec3d = transformedVec3d(template$entityinfo.pos, mirrorIn, rotationIn);
            Vec3d vec3d1 = vec3d.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ());
            NBTTagList nbttaglist = new NBTTagList();
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.xCoord));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.yCoord));
            nbttaglist.appendTag(new NBTTagDouble(vec3d1.zCoord));
            nbttagcompound.setTag("Pos", nbttaglist);
            nbttagcompound.setUniqueId("UUID", UUID.randomUUID());
            Entity entity;

            try
            {
                entity = EntityList.createEntityFromNBT(nbttagcompound, worldIn);
            }
            catch (Exception var15)
            {
                entity = null;
            }

            if (entity != null)
            {
                float f = entity.getMirroredYaw(mirrorIn);
                f = f + (entity.rotationYaw - entity.getRotatedYaw(rotationIn));
                entity.setLocationAndAngles(vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, f, entity.rotationPitch);
                worldIn.spawnEntityInWorld(entity);
            }
        }
    }
}
Template.java 文件源码 项目:CustomWorldGen 阅读 35 收藏 0 点赞 0 评论 0
private NBTTagList writeDoubles(double... values)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (double d0 : values)
    {
        nbttaglist.appendTag(new NBTTagDouble(d0));
    }

    return nbttaglist;
}
Entity.java 文件源码 项目:CustomWorldGen 阅读 26 收藏 0 点赞 0 评论 0
/**
 * creates a NBT list from the array of doubles passed to this function
 */
protected NBTTagList newDoubleNBTList(double... numbers)
{
    NBTTagList nbttaglist = new NBTTagList();

    for (double d0 : numbers)
    {
        nbttaglist.appendTag(new NBTTagDouble(d0));
    }

    return nbttaglist;
}
ItemGoldenLasso.java 文件源码 项目:ExtraUtilities 阅读 23 收藏 0 点赞 0 评论 0
protected NBTTagList newDoubleNBTList(final double... par1ArrayOfDouble) {
    final NBTTagList nbttaglist = new NBTTagList();
    for (final double d1 : par1ArrayOfDouble) {
        nbttaglist.appendTag((NBTBase)new NBTTagDouble(d1));
    }
    return nbttaglist;
}
WidgetTextData.java 文件源码 项目:ExtraUtilities 阅读 20 收藏 0 点赞 0 评论 0
public static Object getNBTBaseData(final NBTBase nbt) {
    if (nbt == null) {
        return null;
    }
    switch (nbt.getId()) {
        case 1: {
            return ((NBTTagByte)nbt).func_150290_f();
        }
        case 2: {
            return ((NBTTagShort)nbt).func_150289_e();
        }
        case 3: {
            return ((NBTTagInt)nbt).func_150287_d();
        }
        case 4: {
            return ((NBTTagLong)nbt).func_150291_c();
        }
        case 5: {
            return ((NBTTagFloat)nbt).func_150288_h();
        }
        case 6: {
            return ((NBTTagDouble)nbt).func_150286_g();
        }
        case 8: {
            return ((NBTTagString)nbt).func_150285_a_();
        }
        case 10: {
            return nbt;
        }
        default: {
            return null;
        }
    }
}
WidgetTextData.java 文件源码 项目:ExtraUtilities 阅读 23 收藏 0 点赞 0 评论 0
public static NBTBase getNBTBase(final Object o) {
    if (o instanceof Integer) {
        return (NBTBase)new NBTTagInt((Integer)o);
    }
    if (o instanceof Short) {
        return (NBTBase)new NBTTagShort((Short)o);
    }
    if (o instanceof Long) {
        return (NBTBase)new NBTTagLong((Long)o);
    }
    if (o instanceof String) {
        return (NBTBase)new NBTTagString((String)o);
    }
    if (o instanceof Double) {
        return (NBTBase)new NBTTagDouble((Double)o);
    }
    if (o instanceof Float) {
        return (NBTBase)new NBTTagFloat((Float)o);
    }
    if (o instanceof NBTTagCompound) {
        return (NBTBase)o;
    }
    if (o instanceof Byte) {
        return (NBTBase)new NBTTagByte((Byte)o);
    }
    LogHelper.debug("Can't find type for " + o, new Object[0]);
    throw null;
}
SchematicEntity.java 文件源码 项目:4Space-5 阅读 20 收藏 0 点赞 0 评论 0
protected NBTTagList newDoubleNBTList(double... par1ArrayOfDouble) {
    NBTTagList nbttaglist = new NBTTagList();
    double[] adouble = par1ArrayOfDouble;
    int i = par1ArrayOfDouble.length;

    for (int j = 0; j < i; ++j) {
        double d1 = adouble[j];
        nbttaglist.appendTag(new NBTTagDouble(d1));
    }

    return nbttaglist;
}
NbtConverter.java 文件源码 项目:wizards-of-lua 阅读 22 收藏 0 点赞 0 评论 0
private Map<Class<? extends NBTBase>, NbtMerger<? extends NBTBase>> getMergers() {
  if (mergers == null) {
    mergers = new HashMap<>();
    registerMerger(NBTTagByte.class, new NbtByteMerger(this));
    registerMerger(NBTTagCompound.class, new NbtCompoundMerger(this));
    registerMerger(NBTTagDouble.class, new NbtDoubleMerger(this));
    registerMerger(NBTTagFloat.class, new NbtFloatMerger(this));
    registerMerger(NBTTagInt.class, new NbtIntMerger(this));
    registerMerger(NBTTagList.class, new NbtListMerger(this));
    registerMerger(NBTTagLong.class, new NbtLongMerger(this));
    registerMerger(NBTTagShort.class, new NbtShortMerger(this));
    registerMerger(NBTTagString.class, new NbtStringMerger(this));
  }
  return mergers;
}
NbtConverter.java 文件源码 项目:wizards-of-lua 阅读 20 收藏 0 点赞 0 评论 0
public static Number toLua(NBTPrimitive nbt) {
  checkNotNull(nbt, "nbt == null!");
  if (nbt instanceof NBTTagDouble)
    return ((NBTTagDouble) nbt).getDouble();
  if (nbt instanceof NBTTagFloat)
    return ((NBTTagFloat) nbt).getDouble();
  return nbt.getLong();
}


问题


面经


文章

微信
公众号

扫码关注公众号