Ejemplo n.º 1
0
 public void beforeReadEntityFromNBT(NBTTagCompound tags) {
   if (player.worldObj.isRemote) return;
   NBTTagCompound customData = new NBTTagCompound();
   try {
     // Load the data
     File file = new File(FlansModHandler.getSaveDirectory(player.worldObj), "Flan.dat");
     customData = CompressedStreamTools.readCompressed(new FileInputStream(file));
     // Fill the unlocks list
     NBTTagList unlocks = customData.getTagList("Unlocks");
     for (int i = 0; i < unlocks.tagCount(); ++i) {
       NBTTagString string = (NBTTagString) unlocks.tagAt(i);
       FlansMod.blueprintsUnlocked = new ArrayList<PlaneType>();
       FlansMod.blueprintsUnlocked.add(PlaneType.getPlane(string.toString()));
     }
     NBTTagList vehicleUnlocks = customData.getTagList("VehicleUnlocks");
     for (int i = 0; i < vehicleUnlocks.tagCount(); ++i) {
       NBTTagString string = (NBTTagString) vehicleUnlocks.tagAt(i);
       FlansMod.vehicleBlueprintsUnlocked = new ArrayList<VehicleType>();
       FlansMod.vehicleBlueprintsUnlocked.add(VehicleType.getVehicle(string.toString()));
     }
     FlansMod.doneTutorial = customData.getBoolean("DoneTutorial");
   } catch (IOException ioexception) {
     System.out.println("Failed to read data for Flan's mod. Using defaults.");
   }
 }
  public String getItemDisplayName(ItemStack par1ItemStack) {
    if (par1ItemStack.hasTagCompound()) {
      NBTTagCompound nbttagcompound = par1ItemStack.getTagCompound();
      NBTTagString nbttagstring = (NBTTagString) nbttagcompound.getTag("title");

      if (nbttagstring != null) {
        return nbttagstring.toString();
      }
    }

    return super.getItemDisplayName(par1ItemStack);
  }