Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.35 KB | None | 0 0
  1.     public static Item sgm_empty_soulgem = (new EmptySoulGem(readPropForName("/sgm/propertylist.txt", "sgm_empty_soulgem")))
  2.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  3.     .setItemName("EmptySoulgem");
  4.    
  5.     public static Item sgm_filled_soulgem = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_filled_soulgem")))
  6.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  7.     .setItemName("ChargedSoulgem");
  8.    
  9.     public static Item sgm_soulshard = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_soulshard")))
  10.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  11.     .setItemName("SoulShard");
  12.    
  13.     public static Item sgm_soulwand = (new SoulWand(readPropForName("/sgm/propertylist.txt", "sgm_soulwand")))
  14.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  15.     .setItemName("Soulwand");
  16.    
  17.     public static Item sgm_uncharged_soulsword = (new SS(readPropForName("/sgm/propertylist.txt", "sgm_uncharged_soulsword")))
  18.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  19.     .setItemName("UnchargedSoulSword");
  20.    
  21.     public static Item sgm_pcharged_soulsword = (new SS_Pcharged(readPropForName("/sgm/propertylist.txt", "sgm_pcharged_soulsword")))
  22.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  23.     .setItemName("PchargedSoulSword");
  24.    
  25.     public static Item sgm_black_soulgem = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_black_soulgem")))
  26.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  27.     .setItemName("BlackSoulgem");
  28.    
  29.     public static Item sgm_fire_soulgem = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_fire_soulgem")))
  30.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  31.     .setItemName("FireSoulGem");
  32.    
  33.    
  34.     public static Item sgm_sdiamond = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_sdiamond")))
  35.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  36.     .setItemName("ShatteredDiamond");
  37.    
  38.     public static Item sgm_fcharged_soulsword = (new SS_Scharged(readPropForName("/sgm/propertylist.txt", "sgm_fcharged_soulsword")))
  39.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  40.     .setItemName("FireChargedSoulsword");
  41.  
  42.     public static Block sgm_oreSpirinite = (new BlockSpirinite(readPropForName("/sgm/propertylist.txt", "sgm_oreSpirinite"), ModLoader.getUniqueSpriteIndex("/terrain.png"))
  43.     .setResistance(5F)
  44.     .setHardness(3F)
  45.     .setLightValue(0.650F)
  46.     .setBlockName("SpiriniteOre")
  47.     .setStepSound(Block.soundStoneFootstep));
  48.    
  49.     public static Item sgm_spirinitebar = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_spirinitebar")))
  50.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  51.     .setItemName("SpiriniteBar");
  52.    
  53.     public static Item sgm_rawspirinite = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_rawspirinite")))
  54.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  55.     .setItemName("SpiriniteShards");
  56.    
  57.     public static Item sgm_scrollskelly = (new scrollSkeleton(readPropForName("/sgm/propertylist.txt", "sgm_scrollskelly")))
  58.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  59.     .setItemName("SkeletonScroll");
  60.    
  61.     public static Item sgm_scrollzomb = (new scrollZombie(readPropForName("/sgm/propertylist.txt", "sgm_scrollzomb")))
  62.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  63.     .setItemName("ZombieScroll");
  64.    
  65.     public static Item sgm_scrollspida = (new scrollSpider(readPropForName("/sgm/propertylist.txt", "sgm_scrollspida")))
  66.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  67.     .setItemName("SpiderScroll");
  68.    
  69.     public static Item sgm_scrollghost = (new scrollGhost(readPropForName("/sgm/propertylist.txt", "sgm_scrollghost")))
  70.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  71.     .setItemName("GhostScroll");
  72.    
  73.     public static Item sgm_gemskelly = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_gemskelly")))
  74.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  75.     .setItemName("skelgem");
  76.    
  77.     public static Item sgm_gemzomb = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_gemzomb")))
  78.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  79.     .setItemName("zombgem");
  80.    
  81.     public static Item sgm_gemspida = (new Item(readPropForName("/sgm/propertylist.txt", "sgm_gemspida")))
  82.     .setIconIndex(ModLoader.getUniqueSpriteIndex("/gui/items.png"))
  83.     .setItemName("spidagem");
  84.  
  85.    
  86.     public Hashtable<String, Integer> readProps(String fileName){
  87.        
  88.         Hashtable<String, Integer> hash = new Hashtable();
  89.         String line;
  90.         String name = "";
  91.         Integer val = 0;
  92.         try
  93.         {    
  94.             BufferedReader in = new BufferedReader(new FileReader(fileName));
  95.             if (!in.ready())
  96.                 throw new IOException();
  97.             while ((line = in.readLine()) != null)
  98.                
  99.                 if(!line.substring(0, 1).equals("*")){
  100.                 //split the line
  101.                 name = line.substring(0, line.indexOf("=") - 1);
  102.                 val = Integer.parseInt(line.substring(line.indexOf("=") + 1));
  103.                 hash.put(name, val);
  104.                 in.close();
  105.                 }
  106.             }
  107.         catch (IOException e)
  108.         {
  109.             System.out.println(e);
  110.             return null;
  111.         }
  112.         return hash;
  113.     }
  114.    
  115.   public static Integer readPropForName(String configFilePathName, String itemName){
  116.        
  117.         String line;
  118.         String name = "";
  119.         Integer val = 0;
  120.         try
  121.         {    
  122.             BufferedReader in = new BufferedReader(new FileReader(configFilePathName));
  123.             if (!in.ready())
  124.                 throw new IOException();
  125.             while ((line = in.readLine()) != null)
  126.                 if(line.length() > 3){
  127.                     if(line.substring(0, 3).equals("sgm")){
  128.                         //split the line
  129.                         name = line.substring(0, line.indexOf("=") - 1);
  130.                         if(name.equals(itemName)){
  131.                             val = Integer.parseInt(line.substring(line.indexOf("=") + 1));
  132.                         }
  133.                     }
  134.                 }
  135.             }
  136.         catch (IOException e)
  137.         {
  138.             System.out.println(e);
  139.             return null;
  140.         }
  141.        
  142.         return val;
  143.     }
  144.  
  145.  
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement