Jump to content

[1.7.10] Every custom mob has stopped working


Hextor

Recommended Posts

I know it sound weird, but today I opened up eclipse and basically all of my mobs stopped working.

Hostile mobs' movements speed just skyrocketed, they kinda teleport while the movement speed attribute is set to 0.1 or below.

setCustomNameTag just doesn't appears.

 

Friendly NPCs like vendors' trade GUI doesn't open up on interact.

I didnt change anything since yesterday, my mobs worked perfectly then.

 

I don't know if its some kind of coding problem/Eclipse/Forge, but it happened me before and reinstalling the whole thing solved the problem.Now I have so much code, rebuilding the whole stuff would take days.

Please help me!

Link to comment
Share on other sites

  • 2 weeks later...

Here is my main mod class

 

package net.aethoscraft.mod;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.aethoscraft.mod.blocks.CopperBlock;
import net.aethoscraft.mod.blocks.CopperOre;
import net.aethoscraft.mod.blocks.MithrilBlock;
import net.aethoscraft.mod.blocks.MithrilOre;
import net.aethoscraft.mod.blocks.RubyOre;
import net.aethoscraft.mod.blocks.SilverOre;
import net.aethoscraft.mod.blocks.SulfuronOre;
import net.aethoscraft.mod.blocks.spec.BookBlock;
import net.aethoscraft.mod.currency.GeneralCurrency;
import net.aethoscraft.mod.entity.hostile.EntityBoar;
import net.aethoscraft.mod.entity.hostile.EntityDefNurgh;
import net.aethoscraft.mod.entity.hostile.EntityGraymWolf;
import net.aethoscraft.mod.entity.npc.DefHuCitizen;
import net.aethoscraft.mod.entity.npc.DefHuVendor;
import net.aethoscraft.mod.handler.EntityHandler;
import net.aethoscraft.mod.handler.PlayerHandler;
import net.aethoscraft.mod.items.AncientSpark;
import net.aethoscraft.mod.items.BackPack;
import net.aethoscraft.mod.items.GeneralFood;
import net.aethoscraft.mod.items.GeneralItems;
import net.aethoscraft.mod.items.GeneralMaterials;
import net.aethoscraft.mod.items.GeneralReagents;
import net.aethoscraft.mod.items.SulfuronSlab;
import net.aethoscraft.mod.items.books.ItemAlchBook1;
import net.aethoscraft.mod.proxy.CommonProxy;
import net.aethoscraft.mod.tileentity.TileEntityBookBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;

		@Mod(modid = Aethoscraft.modid, version = Aethoscraft.version)
public class Aethoscraft {

	public static final String modid = "Aethoscraft";
	public static final String version = "Alpha v0.02";

		@SidedProxy(clientSide = "net.aethoscraft.mod.proxy.ClientProxy",serverSide = "net.aethoscraft.mod.proxy.CommonProxy")
	public static CommonProxy aethosProxy;

		@Instance(modid)
	public static Aethoscraft instance;

	private static int guiIndex = 0;
	public static int GUI_ITEM_INV = guiIndex++;

	//tabs
	public static CreativeTabs GeneralTab;
	public static CreativeTabs CurrencyTab;
	public static CreativeTabs ReagentsTab;
	public static CreativeTabs ABlockTab;
	public static CreativeTabs WeaponTab;
	public static CreativeTabs AFoodTab;
	public static CreativeTabs AMobsTab;
	public static CreativeTabs AMaterialsTab;

	//currency
	public static Item currGoldCoin;
	public static Item currGoldSack;
	public static Item currGoldStamp;

	//books
	public static Item bookAlchBook1;

	//food
	public static Item itemBoarRibs;
	public static Item itemSourGoatCheese;
	public static Item itemBoiledClamMeat;
	public static Item itemSpicedChicken;
	public static Item itemFrostleafBerries;
	public static Item itemGodricsEgg; 
	public static Item itemSaltyBoarMeat; 
	public static Item itemEggSunnySideUp; 

	//materials
	public static Item itemCopperIngot;
	public static Item itemSilverIngot;
	public static Item itemSteelIngot;
	public static Item itemMithrilIngot;
	public static Item itemSulfuronIngot;
	public static Item itemArcaniumIngot; 

	public static Item itemRuby;
	public static Item itemSapphire;
	public static Item itemSunstone;
	public static Item itemMoonstone;

	public static Item itemWaterMote;
	public static Item itemEarthMote;
	public static Item itemAirMote;
	public static Item itemFireMote;
	public static Item itemMagicDust;
	public static Item itemAbyssalCrystal;
	public static Item itemAncientSpark; 

	//reagents
	public static Item itemSaltPile; 
	public static Item itemDistAlcohol; 
	public static Item itemSeaWeed;     
	public static Item itemTapioraRoot; 
	public static Item itemSyldrassilSeed;
	public static Item itemWolfHeart;
	public static Item itemBlueHermetia; 
	public static Item itemSandWeed; 
	public static Item itemScorphasLeaf; 

	//general
	public static Item itemSulfuronSlab;
	public static Item itemBoarTusk;
	public static Item itemWolfPelt;
	public static Item itemVenomSac;
	public static Item itemShinyScales;

	public static Item itemBackPack;

	//blocks
	public static Block oreCopperOre;
	public static Block oreSilverOre;
	public static Block oreMithrilOre;
	public static Block oreSulfuronOre;
	public static Block oreRubyOre;

	public static Block blockCopperBlock;
	public static Block blockMithrilBlock;

	//decorative blocks & stuff

	public static Block blockBook1;

	//Toolmaterials
	public static ToolMaterial defStaffMaterial = EnumHelper.addToolMaterial("StaffMaterial", 0, 400, 10.0F, 3.1F, 0);


@Mod.EventHandler	
public void PreInitialization(FMLPreInitializationEvent event){

	aethosProxy.registerRenderThings();

	//creative tabs
	GeneralTab = new CreativeTabs("General"){
		@SideOnly(Side.CLIENT)
		public Item getTabIconItem(){
		return itemSulfuronSlab;
	}}; 

	CurrencyTab = new CreativeTabs("Currency"){
		@SideOnly(Side.CLIENT)
		public Item getTabIconItem(){
		return currGoldSack;
	}};

	AMaterialsTab = new CreativeTabs("AMaterials"){
		@SideOnly(Side.CLIENT)
		public Item getTabIconItem(){
		return itemCopperIngot;
	}}; 

   		ABlockTab = new CreativeTabs("Block"){
		@SideOnly(Side.CLIENT)
		public Item getTabIconItem(){
		return Item.getItemFromBlock(oreCopperOre);
	}};
/*	
	WeaponTab = new CreativeTabs("Weapon"){
		@SideOnly(Side.CLIENT)
		public Item getTabIconItem(){
			return item2001;
		}};
		*/
	AFoodTab = new CreativeTabs("Food"){
		@SideOnly(Side.CLIENT)
		public Item getTabIconItem(){
			return itemBoarRibs;
		}}; 
	AMobsTab = new CreativeTabs("CustomSpawns"){ //place for custom spawn eggs
			@SideOnly(Side.CLIENT)
			public Item getTabIconItem(){
			return currGoldSack;
		}};
	ReagentsTab = new CreativeTabs("Reagents"){
		@SideOnly(Side.CLIENT)
		public Item getTabIconItem(){
			return itemTapioraRoot;
		}};

	//blocks

	oreCopperOre = new CopperOre(Material.rock).setBlockName("CopperOre");
	oreSilverOre = new SilverOre(Material.rock).setBlockName("SilverOre");
	oreMithrilOre = new MithrilOre(Material.rock).setBlockName("MithrilOre"); 
	oreSulfuronOre = new SulfuronOre(Material.rock).setBlockName("SulfuronOre"); 
	oreRubyOre = new RubyOre(Material.rock).setBlockName("RubyOre");

	blockCopperBlock = new CopperBlock(Material.iron).setBlockName("CopperBlock");
	blockMithrilBlock = new MithrilBlock(Material.iron).setBlockName("MithrilBlock");

	//decorative blocks...

	blockBook1 = new BookBlock(Material.wood).setBlockName("BookBlock1");

	//currency
	currGoldCoin = new GeneralCurrency().setUnlocalizedName("GoldCoin").setTextureName("Aethoscraft:GoldCoin");
	currGoldSack = new GeneralCurrency().setUnlocalizedName("GoldSack").setTextureName("Aethoscraft:GoldSack");
	currGoldStamp = new GeneralCurrency().setUnlocalizedName("GoldStamp").setTextureName("Aethoscraft:GoldStamp");

	//books
	bookAlchBook1 = new ItemAlchBook1().setUnlocalizedName("AlchBook");

	//materials
	itemCopperIngot = new GeneralMaterials().setUnlocalizedName("CopperIngot");
	itemSilverIngot = new GeneralMaterials().setUnlocalizedName("SilverIngot");
	itemSteelIngot = new GeneralMaterials().setUnlocalizedName("SteelIngot");
	itemMithrilIngot = new GeneralMaterials().setUnlocalizedName("MithrilIngot");
	itemSulfuronIngot = new GeneralMaterials().setUnlocalizedName("SulfuronIngot");
	itemArcaniumIngot = new GeneralMaterials().setUnlocalizedName("ArcaniumIngot");

	itemRuby = new GeneralMaterials().setUnlocalizedName("Ruby");
	itemSapphire = new GeneralMaterials().setUnlocalizedName("Sapphire");
	itemSunstone = new GeneralMaterials().setUnlocalizedName("Sunstone");
	itemMoonstone = new GeneralMaterials().setUnlocalizedName("Moonstone");

	itemWaterMote = new GeneralMaterials().setUnlocalizedName("WaterMote");
	itemEarthMote = new GeneralMaterials().setUnlocalizedName("EarthMote");
	itemAirMote = new GeneralMaterials().setUnlocalizedName("AirMote");
	itemFireMote = new GeneralMaterials().setUnlocalizedName("FireMote");
	itemMagicDust = new GeneralMaterials().setUnlocalizedName("MagicDust");
	itemAbyssalCrystal = new GeneralMaterials().setUnlocalizedName("AbyssalCrystal");
	itemAncientSpark = new AncientSpark().setUnlocalizedName("AncientSpark");

	//general
	itemSulfuronSlab = new SulfuronSlab().setUnlocalizedName("SulfuronSlab");
	itemBoarTusk = new GeneralItems().setUnlocalizedName("BoarTusk");
	itemWolfPelt = new GeneralItems().setUnlocalizedName("WolfPelt");
	itemVenomSac = new GeneralItems().setUnlocalizedName("VenomSac");
	itemShinyScales = new GeneralItems().setUnlocalizedName("ShinyScales");

	itemBackPack = new BackPack().setUnlocalizedName("BackPack");

	//reagents
	itemSaltPile = new GeneralReagents().setUnlocalizedName("SaltPile");
	itemDistAlcohol = new GeneralReagents().setUnlocalizedName("DistAlcohol");
	itemSeaWeed = new GeneralReagents().setUnlocalizedName("SeaWeed");
	itemTapioraRoot = new GeneralReagents().setUnlocalizedName("TapioraRoot");
	itemSyldrassilSeed = new GeneralReagents().setUnlocalizedName("SyldrassilSeed");
	itemWolfHeart = new GeneralReagents().setUnlocalizedName("WolfHeart");
	itemBlueHermetia = new GeneralReagents().setUnlocalizedName("BlueHermetia");
	itemSandWeed = new GeneralReagents().setUnlocalizedName("SandWeed");
	itemScorphasLeaf = new GeneralReagents().setUnlocalizedName("ScorphasLeaf");


	//food
	GameRegistry.registerItem(itemBoarRibs = new GeneralFood("BoarRibs", 2, 0.2f, false, new PotionEffect(Potion.regeneration.id, 200, 0)).setAlwaysEdible(), "BoarRibs");
	GameRegistry.registerItem(itemSourGoatCheese = new GeneralFood("SourGoatCheese", 1, 0.2f, false, new PotionEffect(Potion.regeneration.id, 200, 0)).setAlwaysEdible(), "SourGoatCheese");
	GameRegistry.registerItem(itemBoiledClamMeat = new GeneralFood("BoiledClamMeat", 2, 0.2f, false, new PotionEffect(Potion.regeneration.id, 200, 0)).setAlwaysEdible(), "BoiledClamMeat");
	GameRegistry.registerItem(itemSpicedChicken = new GeneralFood("SpicedChicken", 2, 0.2f, false, new PotionEffect(Potion.regeneration.id, 200, 0)).setAlwaysEdible(), "SpicedChicken");
	GameRegistry.registerItem(itemFrostleafBerries = new GeneralFood("FrostleafBerries", 2, 0.2f, false, new PotionEffect(Potion.regeneration.id, 200, 0)).setAlwaysEdible(), "FrostleafBerries");
	GameRegistry.registerItem(itemEggSunnySideUp = new GeneralFood("EggSunnySideUp",2, 0.2f,false,new PotionEffect(Potion.regeneration.id, 200, 0)).setAlwaysEdible(), "EggSunnySideUp");
	GameRegistry.registerItem(itemGodricsEgg = new GeneralFood("GodricsEgg",2,0.2f,false,new PotionEffect(Potion.regeneration.id, 200, 2)).setAlwaysEdible(),"GodricsEgg");
	GameRegistry.registerItem(itemSaltyBoarMeat = new GeneralFood("SaltyBoarMeat",2,0.8f,false,new PotionEffect(Potion.regeneration.id, 200, 0)).setAlwaysEdible(), "SaltyBoarMeat");

	//potions

	//blocks
	GameRegistry.registerBlock(oreCopperOre,"CopperOre");
	GameRegistry.registerBlock(oreSilverOre, "SilverOre");
	GameRegistry.registerBlock(oreMithrilOre,"MithrilOre"); 
	GameRegistry.registerBlock(oreSulfuronOre,"SulfuronOre");
	GameRegistry.registerBlock(oreRubyOre,"RubyOre");

	GameRegistry.registerBlock(blockCopperBlock,"CopperBlock");
	GameRegistry.registerBlock(blockMithrilBlock,"MithrilBlock");

	//decorative blocks...

	GameRegistry.registerBlock(blockBook1,"BlockBook1");

	//currency
	GameRegistry.registerItem(currGoldCoin,"GoldCoin");
	GameRegistry.registerItem(currGoldSack,"GoldSack");
	GameRegistry.registerItem(currGoldStamp,"GoldStamp");

	//books
	GameRegistry.registerItem(bookAlchBook1,"AlchBook");

	//materials
	GameRegistry.registerItem(itemCopperIngot, "CopperIngot");
	GameRegistry.registerItem(itemSilverIngot,"SilverIngot");
	GameRegistry.registerItem(itemSteelIngot,"SteelIngot");
	GameRegistry.registerItem(itemMithrilIngot, "MithrilIngot");
	GameRegistry.registerItem(itemSulfuronIngot, "SulfuronIngot");
	GameRegistry.registerItem(itemArcaniumIngot, "ArcaniumIngot");

	GameRegistry.registerItem(itemRuby, "Ruby");
	GameRegistry.registerItem(itemSapphire, "Sapphire");
	GameRegistry.registerItem(itemSunstone, "Sunstone");
	GameRegistry.registerItem(itemMoonstone, "Moonstone");

	GameRegistry.registerItem(itemWaterMote, "WaterMote");
	GameRegistry.registerItem(itemEarthMote, "EarthMote");
	GameRegistry.registerItem(itemAirMote, "AirMote");
	GameRegistry.registerItem(itemFireMote, "FireMote");
	GameRegistry.registerItem(itemMagicDust, "MagicDust");
	GameRegistry.registerItem(itemAbyssalCrystal, "AbyssalCrystal");
	GameRegistry.registerItem(itemAncientSpark, "AncientSpark");

	//general items
	GameRegistry.registerItem(itemSulfuronSlab, "SulfuronSlab");
	GameRegistry.registerItem(itemBoarTusk, "BoarTusk");
	GameRegistry.registerItem(itemWolfPelt, "WolfPelt");
	GameRegistry.registerItem(itemVenomSac, "VenomSac");
	GameRegistry.registerItem(itemShinyScales, "ShinyScales");


	GameRegistry.registerItem(itemBackPack,"BackPack");

	//reagents
	GameRegistry.registerItem(itemSaltPile,"SaltPile");
	GameRegistry.registerItem(itemDistAlcohol,"DistAlcohol");
	GameRegistry.registerItem(itemSeaWeed,"SeaWeed");
	GameRegistry.registerItem(itemTapioraRoot,"TapioraRoot");
	GameRegistry.registerItem(itemSyldrassilSeed,"SyédrassilSeed");
	GameRegistry.registerItem(itemWolfHeart,"WolfHeart");
	GameRegistry.registerItem(itemBlueHermetia, "BlueHermetia");
	GameRegistry.registerItem(itemSandWeed,"SandWeed");
	GameRegistry.registerItem(itemScorphasLeaf,"ScorphasLeaf");

}

@Mod.EventHandler
public void Initialization(FMLInitializationEvent event){

	//metal,stone & gems
	GameRegistry.addSmelting(oreCopperOre,new ItemStack(itemCopperIngot, 2), 1);
	GameRegistry.addSmelting(oreSilverOre,new ItemStack(itemSilverIngot,1),3);
	GameRegistry.addSmelting(oreMithrilOre,new ItemStack(itemMithrilIngot, 1), 5);
	GameRegistry.addSmelting(oreSulfuronOre,new ItemStack(itemSulfuronIngot, 1), 7);

	GameRegistry.addSmelting(Items.iron_ingot,new ItemStack(itemSteelIngot, 1), 1);

	GameRegistry.addShapelessRecipe(new ItemStack(itemArcaniumIngot),new Object[]{itemMithrilIngot,itemMithrilIngot,itemAncientSpark,itemSulfuronIngot,itemSulfuronIngot});

	//foods
	GameRegistry.addSmelting(Items.egg,new ItemStack(itemEggSunnySideUp,1),1);

	GameRegistry.addShapelessRecipe(new ItemStack(itemGodricsEgg), new Object[]{itemEggSunnySideUp,itemTapioraRoot});
	GameRegistry.addShapelessRecipe(new ItemStack(itemSaltyBoarMeat), new Object[]{Items.cooked_porkchop,itemSaltPile});

	//currency
	GameRegistry.addRecipe(new ItemStack(currGoldSack),new Object[]{"CCC","CCC","CCC",'C', currGoldCoin});
	GameRegistry.addRecipe(new ItemStack(currGoldStamp),new Object[]{"CCC","CCC","CCC",'C', currGoldSack});
	GameRegistry.addShapelessRecipe(new ItemStack(currGoldSack,9,0),new Object[]{currGoldStamp});
	GameRegistry.addShapelessRecipe(new ItemStack(currGoldCoin,9,0),new Object[]{currGoldSack});

	//entities
	//NPC
	EntityHandler.registerCreatures(DefHuVendor.class, "DefHumanVendor");
	EntityHandler.registerCreatures(DefHuCitizen.class, "DefHumanCitizen");
	//EntityHandler.registerModEntityWithEgg(DefHuCitizen.class, "DefHumanCiziten",0xE12072, 0x000000);


	//hostile
	EntityHandler.registerModEntityWithEgg(EntityBoar.class, "Boar", 0xE18222, 0x000000);
	EntityHandler.registerModEntityWithEgg(EntityGraymWolf.class, "GraymWolf", 0xE18519, 0x000000);
	EntityHandler.registerModEntityWithEgg(EntityDefNurgh.class, "Nurgh", 0xE182341, 0x000000);

	//tileentity
	GameRegistry.registerTileEntity(TileEntityBookBlock.class, "BookBlock1");

	//handlers
	NetworkRegistry.INSTANCE.registerGuiHandler(this, new CommonProxy());
	MinecraftForge.EVENT_BUS.register(new PlayerHandler());
}


@Mod.EventHandler
public void PostInitialization(FMLPostInitializationEvent event){

}

}

 

EntityHandler class:

 

package net.aethoscraft.mod.handler;

import java.util.Random;

import net.aethoscraft.mod.Aethoscraft;
import net.aethoscraft.mod.items.ItemCustSpwnEgg;
import net.aethoscraft.mod.proxy.CommonProxy;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;

public class EntityHandler extends CommonProxy {

public static int modEntityID = -1;

public static void registerCreatures(Class entityClass, String name){

	int entityID = EntityRegistry.findGlobalUniqueEntityId();
	long x = name.hashCode();
	Random random = new Random(x);
	int mainColor = random.nextInt() * 16777215;
	int subColor = random.nextInt() * 16777215;

	EntityRegistry.registerGlobalEntityID(entityClass, name, entityID);
	EntityRegistry.addSpawn(entityClass, 50, 2, 4,EnumCreatureType.creature);
	EntityRegistry.registerModEntity(entityClass, name, entityID, Aethoscraft.instance, 16, 1, true);
	EntityList.entityEggs.put(Integer.valueOf(entityID),new EntityList.EntityEggInfo(entityID, mainColor,subColor));

}

public static void registerModEntityWithEgg(Class parEntityClass, String parEntityName,int parEggColor, int parEggSpotsColor)
	{
    	EntityRegistry.registerModEntity(parEntityClass, parEntityName, ++modEntityID,Aethoscraft.instance, 80, 3, false);
    	registerSpawnEgg(parEntityName, parEggColor, parEggSpotsColor);
    	
	} 

 public static void registerSpawnEgg(String parSpawnName, int parEggColor, int parEggSpotsColor)
     {
       Item itemSpawnEgg = new ItemCustSpwnEgg(parSpawnName, parEggColor, parEggSpotsColor).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName("aethoscraft:spawn_egg");
       GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName);
     }
}

 

One of my custom monsters:

 

package net.aethoscraft.mod.entity.hostile;

import java.util.Random;

import net.aethoscraft.mod.Aethoscraft;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;

public class EntityDefNurgh extends EntityMob implements IBossDisplayData {

Random r = new Random();

public EntityDefNurgh(World world){
	super(world);

	this.experienceValue = 3;
	this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
	this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 5.0F));
	this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, true));
	this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));

	this.setCustomNameTag("Greenskin Nurgh");
}

protected void ApplyEntityAttributes(){

	super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(5.0D);
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.01D);
        this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(2.5D);
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(11.0D);
}

 @Override
 public boolean attackEntityAsMob(Entity entityTarget)
 {
     float attackDamage = (float)getEntityAttribute(SharedMonsterAttributes
           .attackDamage).getAttributeValue();
     int knockbackModifier = 0;

     if (entityTarget instanceof EntityLivingBase)
     {
         attackDamage += EnchantmentHelper.getEnchantmentModifierLiving(this, 
               (EntityLivingBase)entityTarget);
         knockbackModifier  += EnchantmentHelper.getKnockbackModifier(this, 
               (EntityLivingBase)entityTarget);
     }

     boolean isTargetHurt = entityTarget.attackEntityFrom(DamageSource
           .causeMobDamage(this), attackDamage);
     return isTargetHurt ;
 }

 @Override
 protected void attackEntity(Entity p_70785_1_, float p_70785_2_)
    {
        if (this.attackTime <= 0 && p_70785_2_ < 2.0F && p_70785_1_.boundingBox.maxY > this.boundingBox.minY && p_70785_1_.boundingBox.minY < this.boundingBox.maxY)
        {
            this.attackTime = 20;
            this.attackEntityAsMob(p_70785_1_);
        }
    }

 @Override
 protected boolean isAIEnabled()
    {
        return true;
    }

protected Item getDropItem() {
	if(r.nextInt(100)<20 && r.nextInt(100)>5)
		return Aethoscraft.itemShinyScales;
	else if(r.nextInt(100)<5)
		return Aethoscraft.itemSeaWeed;
	else
	return null;
}


}

Link to comment
Share on other sites

-the custom name tag just doesnt appear over the monster

-its movement speed is like 2 or 3 times the (I lowered its movements speed from 1.0 to 0.1 a while ago, nothing changed)

 

Here is one of my other custom mobs, maybe I can show in a more clear way whats the problem:

 

-custom name tag doesn't appear

-when right clicking on it, nothing happens

-I can't inflict any damage to it

 

I would like to add that these mobs worked perfectly and some time ago I opened up eclipse and suddenly everything went wrong.

Anyway I'm planning to update my mc & forge to 1.8. Can you recommend a good tutorial on how to do this?

 

package net.aethoscraft.mod.entity.npc;

import net.aethoscraft.mod.gui.DefConvGui;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;

public class DefHuCitizen extends EntityLiving {

public DefHuCitizen(World world) {
	super(world);

	this.setCustomNameTag("Human Citizen");
	this.tasks.addTask(1, new EntityAIWatchClosest(this, EntityPlayer.class, 5.0F));

}
protected void applyEntityAttributes()
    {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.1D);
        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(10.0D);
        this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(50.0D);
    }

@Override
 public boolean interact(EntityPlayer player)
    {

	 if (!this.worldObj.isRemote)
         	{
	        Minecraft.getMinecraft().displayGuiScreen(new DefConvGui()); 
	        return true;
         	}
         else
         	{
             	return super.interact(player);
         	} 
	}

@Override
public boolean canBeCollidedWith()
	{
		return false;
	}
@Override
public boolean canBePushed()
	{
		return false;
	}
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.