コード例 #1
0
 /**
  * Attempts to register the TileEntity for this block. If the process fails, an error is printed
  * to the log via {@link LogHelper#printStackTrace(Exception)}.
  */
 private void registerTileEntity() {
   try {
     TileEntity tile = this.createNewTileEntity(null, 0);
     if (tile != null) {
       Class<? extends TileEntity> tileClass = tile.getClass();
       GameRegistry.registerTileEntity(tileClass, wrapName(getTileEntityName()));
     }
   } catch (Exception e) {
     LogHelper.printStackTrace(e);
   }
 }
コード例 #2
0
ファイル: NEIConfig.java プロジェクト: Mierzen/AgriCraft
 @Override
 public void loadConfig() {
   // register NEI recipe handler
   LogHelper.debug("Registering NEI recipe handlers");
   // mutation handler
   API.registerRecipeHandler(new NEICropMutationHandler());
   API.registerUsageHandler(new NEICropMutationHandler());
   // crop product handler
   API.registerRecipeHandler(new NEICropProductHandler());
   API.registerUsageHandler(new NEICropProductHandler());
   // hide crop blocks in NEI
   hideItems();
 }
コード例 #3
0
ファイル: ItemHandRake.java プロジェクト: rdash99/AgriCraft
 @Override
 @SideOnly(Side.CLIENT)
 public void registerIcons(IIconRegister reg) {
   LogHelper.debug("registering icon for: " + this.getUnlocalizedName());
   icons[0] =
       reg.registerIcon(
           this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf('.') + 1)
               + "_wood");
   icons[1] =
       reg.registerIcon(
           this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf('.') + 1)
               + "_iron");
 }
コード例 #4
0
ファイル: NEIConfig.java プロジェクト: Mierzen/AgriCraft
 private static void hideItems() {
   LogHelper.debug("Hiding crops in NEI");
   for (int i = 0; i < 16; i++) {
     // hide crops block
     AgriCraft.proxy.hideItemInNEI(new ItemStack(Blocks.blockCrop, 1, i));
     // hide water pad
     AgriCraft.proxy.hideItemInNEI(new ItemStack(Blocks.waterPad, 1, i));
     // hide sprinkler
     AgriCraft.proxy.hideItemInNEI(new ItemStack(Blocks.blockSprinkler, 1, i));
     // hide debugger
     if (!ConfigurationHandler.debug) {
       AgriCraft.proxy.hideItemInNEI(new ItemStack(Items.debugItem, 1, i));
     }
     // hide plant blocks
     for (BlockModPlant plant : Crops.crops) {
       AgriCraft.proxy.hideItemInNEI(new ItemStack(plant, 1, i));
     }
     // hide botania crops
     if (ModHelper.allowIntegration(Names.Mods.botania)) {
       for (BlockModPlant plant : BotaniaHelper.botaniaCrops) {
         AgriCraft.proxy.hideItemInNEI(new ItemStack(plant, 1, i));
       }
     }
     // hide thaumcraft crops
     if (ModHelper.allowIntegration(Names.Mods.thaumcraft)) {
       for (BlockModPlant plant : ThaumcraftHelper.thaumcraftCrops) {
         AgriCraft.proxy.hideItemInNEI(new ItemStack(plant, 1, i));
       }
     }
     // hide ars magica crops
     if (ModHelper.allowIntegration(Names.Mods.arsMagica)) {
       for (BlockModPlant plant : ArsMagicaHelper.arsMagicaCrops) {
         AgriCraft.proxy.hideItemInNEI(new ItemStack(plant, 1, i));
       }
     }
     // hide resource crops
     if (ConfigurationHandler.resourcePlants) {
       for (BlockModPlant plant : ResourceCrops.vanillaCrops) {
         AgriCraft.proxy.hideItemInNEI(new ItemStack(plant, 1, i));
       }
       for (BlockModPlant plant : ResourceCrops.modCrops) {
         AgriCraft.proxy.hideItemInNEI(new ItemStack(plant, 1, i));
       }
     }
     // hide custom crops
     if (ConfigurationHandler.customCrops) {
       for (BlockModPlant customCrop : CustomCrops.customCrops) {
         AgriCraft.proxy.hideItemInNEI(new ItemStack(customCrop, 1, i));
       }
     }
     // hide debugger
     if (ConfigurationHandler.debug) {
       AgriCraft.proxy.hideItemInNEI(new ItemStack(Items.debugItem, 1, i));
     }
   }
   LogHelper.debug("Hiding custom wood objects");
   Field[] blocks = Blocks.class.getDeclaredFields();
   for (Field field : blocks) {
     if (BlockCustomWood.class.isAssignableFrom(field.getType())) {
       try {
         Block block = (Block) field.get(null);
         if (block == null) {
           continue;
         }
         ItemStack stack = new ItemStack(block);
         ArrayList<ItemStack> list = new ArrayList<ItemStack>();
         list.add(stack);
         API.setItemListEntries(stack.getItem(), list);
       } catch (Exception e) {
         e.printStackTrace();
       }
     }
   }
 }