gt:         if (min > 0 && max > 0)
context: //	  Copyright 2012-2014 Matthew Karcz
  //
  //	  This file is part of The Rediscovered Mod.
  //
  //    The Rediscovered Mod is free software: you can redistribute it and/or modify
  //    it under the terms of the GNU General Public License as published by
  //    the Free Software Foundation, either version 3 of the License, or
  //    (at your option) any later version.
  //
  //    The Rediscovered Mod is distributed in the hope that it will be useful,
  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  //    GNU General Public License for more details.
  //
  //    You should have received a copy of the GNU General Public License
  //    along with The Rediscovered Mod.  If not, see <http://www.gnu.org/licenses/>.
  
  
  
  
  
  
  
  
  
  
  
  package RediscoveredMod;
  
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Map;
  import java.util.Random;
  import java.util.Collection;
  import java.util.Collections;
  
  import net.minecraft.item.Item;
  import net.minecraft.util.Tuple;
  import net.minecraft.village.MerchantRecipeList;
  import net.minecraft.world.gen.structure.ComponentVillageStartPiece;
  import net.minecraft.world.gen.structure.StructureVillagePieceWeight;
  
  import com.google.common.collect.ArrayListMultimap;
  import com.google.common.collect.Lists;
  import com.google.common.collect.Maps;
  import com.google.common.collect.Multimap;
  
  import cpw.mods.fml.common.FMLLog;
  
  /**
   * Registry for villager trading control
   *
   * @author cpw
   *
   */
  public class GreenRegistry
  {
      private static final GreenRegistry INSTANCE = new GreenRegistry();
  
      private Multimap<Integer, IVillageTradeHandler> tradeHandlers = ArrayListMultimap.create();
      private Map<Class<?>, IVillageCreationHandler> villageCreationHandlers = Maps.newHashMap();
      private Map<Integer, String> newVillagers = Maps.newHashMap();
      private List<Integer> newVillagerIds = Lists.newArrayList();
  
      /**
       * Allow access to the {@link net.minecraft.world.gen.structure.StructureVillagePieces} array controlling new village
       * creation so you can insert your own new village pieces
       *
       * @author cpw
       *
       */
      public interface IVillageCreationHandler
      {
          /**
           * Called when {@link net.minecraft.world.gen.structure.MapGenVillage} is creating a new village
           *
           * @param random
           * @param i
           */
          StructureVillagePieceWeight getVillagePieceWeight(Random random, int i);
  
          /**
           * The class of the root structure component to add to the village
           */
          Class<?> getComponentClass();
  
  
          /**
           * Build an instance of the village component {@link net.minecraft.world.gen.structure.StructureVillagePieces}
           * @param villagePiece
           * @param startPiece
           * @param pieces
           * @param random
           * @param p1
           * @param p2
           * @param p3
           * @param p4
           * @param p5
           */
          Object buildComponent(StructureVillagePieceWeight villagePiece, ComponentVillageStartPiece startPiece, List pieces, Random random, int p1,
                  int p2, int p3, int p4, int p5);
      }
  
      /**
       * Allow access to the {@link MerchantRecipeList} for a villager type for manipulation
       *
       * @author cpw
       *
       */
      public interface IVillageTradeHandler
      {
          /**
           * Called to allow changing the content of the {@link MerchantRecipeList} for the villager
           * supplied during creation
           *
           * @param villager
           * @param recipeList
           */
          void manipulateTradesForVillager(EntityGreenVillager villager, MerchantRecipeList recipeList, Random random);
      }
  
      public static GreenRegistry instance()
      {
          return INSTANCE;
      }
  
      /**
       * Register a new skin for a villager type
       *
       * @param villagerId
       * @param villagerSkin
       */
      public void registerVillagerType(int villagerId, String villagerSkin)
      {
          if (newVillagers.containsKey(villagerId))
          {
              FMLLog.severe("Attempt to register duplicate villager id %d", villagerId);
              throw new RuntimeException();
          }
          newVillagers.put(villagerId, villagerSkin);
          newVillagerIds.add(villagerId);
      }
  
      /**
       * Register a new village creation handler
       *
       * @param handler
       */
      public void registerVillageCreationHandler(IVillageCreationHandler handler)
      {
          villageCreationHandlers.put(handler.getComponentClass(), handler);
      }
  
      /**
       * Register a new villager trading handler for the specified villager type
       *
       * @param villagerId
       * @param handler
       */
      public void registerVillageTradeHandler(int villagerId, IVillageTradeHandler handler)
      {
          tradeHandlers.put(villagerId, handler);
      }
  
      /**
       * Callback to setup new villager types
       *
       * @param villagerType
       * @param defaultSkin
       */
      public static String getVillagerSkin(int villagerType, String defaultSkin)
      {
          if (instance().newVillagers.containsKey(villagerType))
          {
              return instance().newVillagers.get(villagerType);
          }
          return defaultSkin;
      }
  
      /**
       * Returns a list of all added villager types
       *
       * @return newVillagerIds
       */
      public static Collection<Integer> getRegisteredVillagers()
      {
          return Collections.unmodifiableCollection(instance().newVillagerIds);
      }
      /**
       * Callback to handle trade setup for villagers
       *
       * @param recipeList
       * @param villager
       * @param villagerType
       * @param random
       */
      public static void manageVillagerTrades(MerchantRecipeList recipeList, EntityGreenVillager villager, int villagerType, Random random)
      {
          for (IVillageTradeHandler handler : instance().tradeHandlers.get(villagerType))
          {
              handler.manipulateTradesForVillager(villager, recipeList, random);
          }
      }
  
      public static void addExtraVillageComponents(ArrayList components, Random random, int i)
      {
          List<StructureVillagePieceWeight> parts = components;
          for (IVillageCreationHandler handler : instance().villageCreationHandlers.values())
          {
              parts.add(handler.getVillagePieceWeight(random, i));
          }
      }
  
      public static Object getVillageComponent(StructureVillagePieceWeight villagePiece, ComponentVillageStartPiece startPiece, List pieces, Random random,
              int p1, int p2, int p3, int p4, int p5)
      {
          return instance().villageCreationHandlers.get(villagePiece.villagePieceClass).buildComponent(villagePiece, startPiece, pieces, random, p1, p2, p3, p4, p5);
      }
  
  
      public static void addEmeraldBuyRecipe(EntityGreenVillager villager, MerchantRecipeList list, Random random, Item item, float chance, int min, int max)
      {
  