diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-08-24 08:16:37 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-08-24 08:16:37 -0400 |
| commit | 70c1354a4a96698758a88c032866288f79de6f5a (patch) | |
| tree | eca51294e84b90a4cb3230bc2c7900469e784184 /src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java | |
Diffstat (limited to 'src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java')
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java new file mode 100644 index 0000000..a7da41d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/entity/EntityMagicAuthor.java @@ -0,0 +1,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);
+ }
+ }
+}
|
