コード例 #1
0
 private boolean tryBreeding(List<EntityPair> targets) {
   Entity animalA;
   Entity animalB;
   EntityPair pair;
   if (!targets.isEmpty()) {
     pair = targets.remove(0);
     animalA = pair.getEntityA(worldObj);
     animalB = pair.getEntityB(worldObj);
     if (!(animalA instanceof EntityAnimal) || !(animalB instanceof EntityAnimal)) {
       return false;
     }
     ((EntityAnimal) animalA).func_146082_f(null); // setInLove(EntityPlayer breeder)
     ((EntityAnimal) animalB).func_146082_f(null); // setInLove(EntityPlayer breeder)
     return true;
   }
   return false;
 }
コード例 #2
0
 private void setAnimalInLove(EntityAnimal animal, EntityPlayer player, ItemStack stack) {
   if (!animal.isInLove()) {
     animal.func_146082_f(player);
     if (!player.capabilities.isCreativeMode)
       if (--stack.stackSize <= 0)
         player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
   }
 }