Examples of NBTBase


Examples of net.minecraft.nbt.NBTBase

            case 10: // Map
                NBTTagCompound tc = (NBTTagCompound) v;
                HashMap<String, Object> vmap = new HashMap<String, Object>();
                for (Object t : tc.func_150296_c()) {
                    String st = (String) t;
                    NBTBase tg = tc.getTag(st);
                    vmap.put(st, getNBTValue(tg));
                }
                val = vmap;
                break;
            case 11: // Int[]
View Full Code Here

Examples of net.minecraft.nbt.NBTBase

            int blkdat = ss.getBlockData(cx, ty, cz);
            String[] te_fields = HDBlockModels.getTileEntityFieldsNeeded(blkid,  blkdat);
            if(te_fields != null) {
                vals.clear();
                for(String id: te_fields) {
                    NBTBase v = tc.getTag(id)/* Get field */
                    if(v != null) {
                        Object val = getNBTValue(v);
                        if(val != null) {
                            vals.add(id);
                            vals.add(val);
View Full Code Here

Examples of net.minecraft.nbt.NBTBase

 
  public void read(NBTTagCompound compound) {
    rotation = compound.getByte("rotation");
   
    clearItems();
    NBTBase itemsTag = compound.getTag("Items");
    if (itemsTag instanceof NBTTagList) {
     
      // Backward compatibility.
      NBTTagList items = (NBTTagList)itemsTag;
      for (int i = 0; i < items.tagCount(); i++) {
View Full Code Here

Examples of net.minecraft.nbt.NBTBase

        HashSet<TypeData> datas = new HashSet<TypeData>();

        NBTTagCompound nbt = (NBTTagCompound) obj;

        TypeData data;
        NBTBase tag;
        for (String name : (Collection<String>) nbt.func_150296_c())
        {
            tag = nbt.getTag(name);
            data = getEntryData();
            data.putField(TYPE, tag.getId());
            data.putField(KEY, name);

            if (tag instanceof NBTTagCompound)
            {
                data.putField(COMPOUND, tag);
            }
            else if (tag instanceof NBTTagIntArray)
            {
                data.putField(I_ARRAY, ((NBTTagIntArray) tag).func_150302_c());
            }
            else if (tag instanceof NBTTagByteArray)
            {
                data.putField(B_ARRAY, ((NBTTagByteArray) tag).func_150292_c());
            }
            else if (tag instanceof NBTTagList)
            {
                data.putField(TAG_LIST, tag);
            }
            else if (tag instanceof NBTBase.NBTPrimitive)
            {
                String val = tag.toString();

                if (tag.getId() != new NBTTagInt(0).getId())
                {
                    val = val.substring(0, val.length() - 1);
                }

                data.putField(PRIMITIVE, val);
View Full Code Here

Examples of net.minecraft.nbt.NBTBase

  }
  /** Gets the type of a tag from the ItemStack's custom NBT data. <br>
   *  See {@link NBTBase#NBTTypes} for possible return values. <br>
   *  Returns null if the tag doesn't exist. */
  public static String getType(ItemStack stack, String... tags) {
    NBTBase tag = getTag(stack, tags);
    return ((tag != null) ? NBTBase.NBTTypes[tag.getId()] : null);
  }
View Full Code Here

Examples of net.minecraft.nbt.NBTBase

  }
  /** Gets a value from the ItemStack's custom NBT data. Example: <br>
   <code> int color = ItemUtils.get(stack, -1, "display", "color"); </code> <br>
   *  Returns defaultValue if any parent compounds or the value tag don't exist. */
  public static <T> T get(ItemStack stack, T defaultValue, String... tags) {
    NBTBase tag = getTag(stack, tags);
    return (T)((tag != null) ? NbtUtils.getTagValue(tag) : defaultValue);
  }
View Full Code Here

Examples of net.minecraft.nbt.NBTBase

    allowAutoDestroy = par1nbtTagCompound.getBoolean("allowAutoDestroy");
    inv.readFromNBT(par1nbtTagCompound);
    settingsList.clear();
    NBTTagList list = par1nbtTagCompound.getTagList("settings", 10);
    while(list.tagCount() > 0) {
      NBTBase base = list.removeTag(0);
      String name = ((NBTTagCompound)base).getString("name");
      NBTTagCompound value = ((NBTTagCompound)base).getCompoundTag("content");
      SecuritySettings settings = new SecuritySettings(name);
      settings.readFromNBT(value);
      settingsList.put(name, settings);
    }
    excludedCC.clear();
    list = par1nbtTagCompound.getTagList("excludedCC", 3);
    while(list.tagCount() > 0) {
      NBTBase base = list.removeTag(0);
      excludedCC.add(((NBTTagInt)base).func_150287_d());
    }
  }
View Full Code Here

Examples of net.minecraft.nbt.NBTBase

  public void handleListPacket(NBTTagCompound tag) {
    excludedCC.clear();
    NBTTagList list = tag.getTagList("list", 3);
    while(list.tagCount() > 0) {
      NBTBase base = list.removeTag(0);
      excludedCC.add(((NBTTagInt)base).func_150287_d());
    }
  }
View Full Code Here

Examples of net.minecraft.nbt.NBTBase

    configSlot.readFromNBT( data, "config" );

    NBTTagCompound storedItems = data.getCompoundTag( "storedItems" );
    for (Object key : storedItems.func_150296_c())
    {
      NBTBase obj = storedItems.getTag( (String) key );
      if ( obj instanceof NBTTagCompound )
      {
        inventory.storedItems.add( AEItemStack.create( ItemStack.loadItemStackFromNBT( (NBTTagCompound) obj ) ) );
      }
    }
View Full Code Here

Examples of net.minecraft.nbt.NBTBase

        if ( cA.size() != cB.size() )
          return false;

        for (String name : cA)
        {
          NBTBase tag = ctA.getTag( name );
          NBTBase aTag = ctB.getTag( name );
          if ( aTag == null )
          {
            return false;
          }

          if ( !NBTEqualityTest( tag, aTag ) )
          {
            return false;
          }
        }

        return true;
      }

      case 9: // ) // A instanceof NBTTagList )
      {
        NBTTagList lA = (NBTTagList) A;
        NBTTagList lB = (NBTTagList) B;
        if ( lA.tagCount() != lB.tagCount() )
          return false;

        List<NBTBase> tag = tagList( lA );
        List<NBTBase> aTag = tagList( lB );
        if ( tag.size() != aTag.size() )
          return false;

        for (int x = 0; x < tag.size(); x++)
        {
          if ( aTag.get( x ) == null )
            return false;

          if ( !NBTEqualityTest( tag.get( x ), aTag.get( x ) ) )
            return false;
        }

        return true;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.