Пример #1
0
  /** create a new instance of an entity from NBT store */
  public static Entity createEntityFromNBT(NBTTagCompound par0NBTTagCompound, World par1World) {
    Entity entity = null;

    try {
      Class class1 = (Class) stringToClassMapping.get(par0NBTTagCompound.getString("id"));

      if (class1 != null) {
        entity =
            (Entity)
                class1
                    .getConstructor(new Class[] {net.minecraft.src.World.class})
                    .newInstance(new Object[] {par1World});
      }
    } catch (Exception exception) {
      exception.printStackTrace();
    }

    if (entity != null) {
      entity.readFromNBT(par0NBTTagCompound);
    } else {
      System.out.println(
          (new StringBuilder())
              .append("Skipping Entity with id ")
              .append(par0NBTTagCompound.getString("id"))
              .toString());
    }

    return entity;
  }
  public void func_70383_a(Entity par1Entity) {
    if (field_70391_e != null) {
      NBTTagCompound nbttagcompound = new NBTTagCompound();
      par1Entity.addEntityID(nbttagcompound);
      NBTBase nbtbase;

      for (Iterator iterator = field_70391_e.getTags().iterator();
          iterator.hasNext();
          nbttagcompound.setTag(nbtbase.getName(), nbtbase.copy())) {
        nbtbase = (NBTBase) iterator.next();
      }

      par1Entity.readFromNBT(nbttagcompound);
    }
  }
Пример #3
0
  public void writeNBTTagsTo(Entity par1Entity) {
    if (this.spawnerTags != null) {
      NBTTagCompound var2 = new NBTTagCompound();
      par1Entity.addEntityID(var2);
      Iterator var3 = this.spawnerTags.getTags().iterator();

      while (var3.hasNext()) {
        NBTBase var4 = (NBTBase) var3.next();
        var2.setTag(var4.getName(), var4.copy());
      }

      par1Entity.readFromNBT(var2);
    } else if (par1Entity instanceof EntityLiving && par1Entity.worldObj != null) {
      ((EntityLiving) par1Entity).initCreature();
    }
  }
Пример #4
0
  /** create a new instance of an entity from NBT store */
  public static Entity createEntityFromNBT(NBTTagCompound par0NBTTagCompound, World par1World) {
    Entity var2 = null;

    try {
      Class var3 = (Class) stringToClassMapping.get(par0NBTTagCompound.getString("id"));

      if (var3 != null) {
        var2 =
            (Entity)
                var3.getConstructor(new Class[] {World.class})
                    .newInstance(new Object[] {par1World});
      }
    } catch (Exception var4) {
      var4.printStackTrace();
    }

    if (var2 != null) {
      var2.readFromNBT(par0NBTTagCompound);
    } else {
      System.out.println("Skipping Entity with id " + par0NBTTagCompound.getString("id"));
    }

    return var2;
  }