blob: a7da41d7f8616e7c2d9b3bf22368a38855ae8aed (
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
50
51
52
53
54
55
56
57
|
package jp.plusplus.fbs.entity;
import cpw.mods.fml.common.registry.EntityRegistry;
import jp.plusplus.fbs.FBS;
import jp.plusplus.fbs.Registry;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAIFollowGolem;
import net.minecraft.entity.ai.EntityAITasks;
import net.minecraft.entity.ai.EntityAIVillagerMate;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import shift.mceconomy2.api.MCEconomyAPI;
/**
* Created by plusplus_F on 2016/02/24.
*/
public class EntityMagicAuthor extends EntityVillager {
public EntityMagicAuthor(World p_i1748_1_) {
super(p_i1748_1_);
//必要のないタスクを削除
for(int i=0;i<tasks.taskEntries.size();i++){
EntityAIBase ai=((EntityAITasks.EntityAITaskEntry)tasks.taskEntries.get(i)).action;
if(ai instanceof EntityAIVillagerMate || ai instanceof EntityAIFollowGolem){
tasks.removeTask(ai);
}
}
}
public void onLivingUpdate(){
super.onLivingUpdate();
setGrowingAge(100);
}
@Override
public boolean interact(EntityPlayer player) {
ItemStack itemstack = player.inventory.getCurrentItem();
boolean flag = itemstack != null && itemstack.getItem() == Items.spawn_egg;
if (!flag && this.isEntityAlive() && !this.isTrading() && !this.isChild() && !player.isSneaking()) {
if (!this.worldObj.isRemote) {
//this.setCustomer(player);
//MCEconomyAPI.openShopGui(Registry.shopAuthorId,player,worldObj,(int)posX, (int)posY, (int)posZ);
player.openGui(FBS.instance, FBS.GUI_SHOP_AUTHOR_ID, worldObj, (int)posX, (int)posY, (int)posZ);
}
return true;
} else {
return super.interact(player);
}
}
}
|