OSDN Git Service

素材製作台(減算処理・NBT処理抜き)を製作
[chemicraft/chemicraft.git] / common / chemicraft / util / ComparatorItemStack.java
1 package chemicraft.util;
2
3 import java.util.Comparator;
4
5 import net.minecraft.src.ItemStack;
6
7
8 public class ComparatorItemStack implements Comparator {
9
10         @Override
11         public int compare(Object o1, Object o2) {
12                 ItemStack i1 = (ItemStack) o1;
13                 ItemStack i2 = (ItemStack) o2;
14                 if(i1.itemID == i2.itemID){
15                         return i1.getItemDamage() > i2.getItemDamage() ? 1 : -1;
16                 }
17                 return i1.itemID > i2.itemID ? 1 : -1;
18         }
19
20 }