При использовании предмета не появляется моб.

Версия Minecraft
1.7.10
1,007
36
206
При использовании предмета должен спауниться моб, но этого не происходит.
Код предмета
Код:
package gaia.items;

import gaia.Gaia;
import gaia.entity.EntityGaiaNPCTrader;

import java.util.List;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ItemSpawnCardTrader extends Item {

   String texture;


   public ItemSpawnCardTrader(String texture) {
      this.texture = texture;
      this.setUnlocalizedName("GrimoireOfGaia.SpawnCardTrader");
      
   }

   @SideOnly(Side.CLIENT)
   public EnumRarity getRarity(ItemStack par1ItemStack) {
      return EnumRarity.rare;
   }

   public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
      par3List.add(StatCollector.translateToLocal("item.GrimoireOfGaia.SpawnCardTrader.desc"));
   }

   public ItemStack onItemUseFinish(ItemStack par1ItemStack, World world, EntityPlayer entityplayer) {
      if(!entityplayer.capabilities.isCreativeMode) {
         --par1ItemStack.stackSize;
      }

      world.playSoundAtEntity(entityplayer, "random.wood click", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
      if(!world.isRemote) {
         EntityGaiaNPCTrader entityspawning = new EntityGaiaNPCTrader(world);
         entityspawning.setPosition(entityplayer.posX + 0.0D, entityplayer.posY + 0.0D, entityplayer.posZ + 0.0D);
         world.spawnEntityInWorld(entityspawning);
      }

      return par1ItemStack;
   }

   public int getMaxItemUseDuration(ItemStack par1ItemStack) {
      return 32;
   }

   public EnumAction getItemUseAction(ItemStack par1ItemStack) {
      return EnumAction.bow;
   }

   public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
      par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
      return par1ItemStack;
   }

   public void registerIcons(IIconRegister iconRegister) {
      this.itemIcon = iconRegister.registerIcon("gaia:" + this.texture);
   }
}
Код моба
Код:
package gaia.entity;

import gaia.GaiaItem;
import gaia.entity.base.EntityMobMerchant;
import gaia.entity.base.Trade;
import net.minecraft.item.ItemStack;
import net.minecraft.village.MerchantRecipeList;
import net.minecraft.world.World;

public class EntityGaiaNPCTrader extends EntityMobMerchant {

   public EntityGaiaNPCTrader(World var1) {
      super(var1);
   }

   protected String getLivingSound() {
      return "gaia:passive_say";
   }

   protected String getHurtSound() {
      return "gaia:passive_hurt";
   }

   protected String getDeathSound() {
      return "gaia:passive_death";
   }

   protected void dropFewItems(boolean par1, int par2) {
      if(par1 && (this.rand.nextInt(1) == 0 || this.rand.nextInt(1 + par2) > 0)) {
         this.entityDropItem(new ItemStack(GaiaItem.SpawnCardTrader, 1, 1), 0.0F);
      }

   }

   public void addRecipies(MerchantRecipeList recipes) {
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscCurrency, 1, 1), new ItemStack(GaiaItem.MiscCurrency, 1, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscCurrency, 1, 0), new ItemStack(GaiaItem.BoxIron, 1, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscCurrency, 4, 0), new ItemStack(GaiaItem.BoxGold, 1, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscCurrency, 8, 0), new ItemStack(GaiaItem.BoxDiamond, 1, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscCurrency, 6, 0), new ItemStack(GaiaItem.BagBook, 1, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscCurrency, 1, 0), new ItemStack(GaiaItem.BagOre, 1, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscCurrency, 2, 0), new ItemStack(GaiaItem.BagRecord, 1, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscCurrency, 4, 0), new ItemStack(GaiaItem.MiscBook, 1, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscGigaGear, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 8, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscPage, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscRing, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 8, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscRing, 1, 1), new ItemStack(GaiaItem.MiscCurrency, 8, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscRing, 1, 2), new ItemStack(GaiaItem.MiscCurrency, 8, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.MiscRing, 1, 3), new ItemStack(GaiaItem.MiscCurrency, 8, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.SpawnCardCreeperGirl, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 2, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.SpawnCardTrader, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 2, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.PropWeapon, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 2, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.PropWeapon, 1, 1), new ItemStack(GaiaItem.MiscCurrency, 2, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.FanFire, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.FanIce, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookBane, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookBattle, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookBlazing, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookFortune, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 8, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookNature, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookEnder, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookFreezing, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookBuff, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 8, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookNightmare, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.BookMetal, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 4, 0)));
      recipes.add(new Trade(new ItemStack(GaiaItem.AccessoryDollCursed, 1, 0), new ItemStack(GaiaItem.MiscCurrency, 8, 0)));
   }
}
 
1,007
36
206
Я немного изменил код предмета. Теперь моб спаунится, но вместе с ним фантомный моб(тот же моб только с ним нельзя взаимодействовать)
Код:
package gaia.items;

import gaia.entity.EntityGaiaNPCCreeperGirl;

import java.util.List;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ItemSpawnCardCreeperGirl extends Item {

   String texture;


   public ItemSpawnCardCreeperGirl(String texture) {
      this.texture = texture;
      this.maxStackSize = 16;
      this.setUnlocalizedName("GrimoireOfGaia.SpawnCardCreeperGirl");
      
   }

   @SideOnly(Side.CLIENT)
   public EnumRarity getRarity(ItemStack par1ItemStack) {
      return EnumRarity.rare;
   }

   public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
      par3List.add(StatCollector.translateToLocal("item.GrimoireOfGaia.SpawnCreeperGirl.desc"));
   }

   public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
      
      world.playSoundAtEntity(entityplayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
      if(true) {
         EntityGaiaNPCCreeperGirl entityspawning = new EntityGaiaNPCCreeperGirl(world);
         entityspawning.setPosition(entityplayer.posX + 0.0D, entityplayer.posY + 0.0D, entityplayer.posZ + 0.0D);
         world.spawnEntityInWorld(entityspawning);
      }
 return itemstack;

      
   }

   public int getMaxItemUseDuration(ItemStack par1ItemStack) {
      return 32;
   }
  

   public void registerIcons(IIconRegister iconRegister) {
      this.itemIcon = iconRegister.registerIcon("gaia:" + this.texture);
   }
}

В EntityMobMerchant просто прописаны характеристики моба (кол-во хп, GUI жителя и т.д) ничего интересного.
 
Сверху