blob: 673b8868652059964d759c4eb73aae429e72aebd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package jp.plusplus.fbs.container.slot;
import jp.plusplus.fbs.Registry;
import jp.plusplus.fbs.alchemy.AlchemyRegistry;
import jp.plusplus.fbs.alchemy.IAlchemyMaterial;
import jp.plusplus.fbs.item.ItemBookSorcery;
import jp.plusplus.fbs.item.ItemStoneSpirit;
import jp.plusplus.fbs.spirit.SpiritManager;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import shift.mceconomy2.api.MCEconomyAPI;
/**
* Created by plusplus_F on 2015/11/04.
*/
public class SlotContract extends Slot{
protected int type;
public SlotContract(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int type) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
this.type=type;
}
@Override
public boolean isItemValid(ItemStack itemStack) {
if(type==0){
//武器
return SpiritManager.isTool(itemStack.getItem());
}
else if(type==1){
//精霊石
return itemStack.getItem() instanceof ItemStoneSpirit;
}
else if(type==2){
//書物
if(!(itemStack.getItem() instanceof ItemBookSorcery)) return false;
Registry.BookData bd=Registry.GetBookDataFromItemStack(itemStack);
if(bd==null) return false;
return bd.title.equals("fbs.contract");
}
return true;
}
}
|