Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Weird Entity Glitch. 1.7.10


Recommended Posts

After I die and try to attack my mobs, the attacks register through them, meaning I am able to break a block through one of my entitys, but I can still collide with them, and they can attack me, its with every single entity in my mod. vanilla mobs don't have an effect, so its not my computer or anything like that. I have no Idea at this point, but just for example im going to show one of my mob classes to see if there is a problem, because personally I couldn't find one, ill also post my main registry to make sure im loading them into the game correctly, thanks for all of your time.

 

Mob code:

package com.OlympiansMod.entity;

package com.OlympiansMod.entity;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
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.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
import net.minecraft.entity.ai.EntityAIMoveTowardsTarget;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;

public class GreekUndead extends EntityMob{

private int attackTimer;

public GreekUndead(World world) { 
	super(world);
	this.setSize(1.1F, 2F);
        this.getNavigator().setAvoidsWater(true);
        this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true));
        this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 2.0D, 32.0F));
        this.tasks.addTask(3, new EntityAIMoveTowardsRestriction(this, 1.0D));
        this.tasks.addTask(4, new EntityAIWander(this, 0.6D));
        this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
        this.tasks.addTask(6, new EntityAILookIdle(this));
        this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
        this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, Zeus.class, 0, true));
        this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, ZeusExtended.class, 0, true));

    }
protected boolean isAIEnabled(){
	return true;
}
protected void applyEntityAttributes(){
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0f); 
	this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.50D);
	this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10.0D);
}

 public void onLivingUpdate()
    {
        super.onLivingUpdate();

        if (this.attackTimer > 0)
        {
            --this.attackTimer;
        }

    }
    public boolean attackEntityAsMob(Entity entity)
    {
        this.attackTimer = 20;
        this.worldObj.setEntityState(this, (byte)4);
        boolean flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(10 + this.rand.nextInt(15)));

        if (flag)
        {
            entity.motionX += 0.4000000059604645D;
        }

        this.playSound("mob.irongolem.throw", 1.0F, 1.0F);
        return flag;
    }
    @SideOnly(Side.CLIENT)
    public void handleHealthUpdate(byte par1)
    {
        if (par1 == 4)
        {
            this.attackTimer = 10;
            this.playSound("mob.irongolem.throw", 1.0F, 1.0F);
        }
        else if (par1 == 11)
        {
        }
        else
            super.handleHealthUpdate(par1);
        }
    
   
    @SideOnly(Side.CLIENT)
    public int getAttackTimer()
    {
        return this.attackTimer;
    }

    protected String getHurtSound()
    {
        return "mob.irongolem.hit";
    }

    protected String getDeathSound()
    {
        return "mob.irongolem.death";
    }

    protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_)
    {
        this.playSound("mob.irongolem.walk", 1.0F, 1.0F);
  
    }
}

 

MainRegistry:

package com.OlympiansMod.Main;

import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraftforge.event.entity.living.LivingDeathEvent;

import com.OlympiansMod.Block.ModBlocks;
import com.OlympiansMod.Item.ModItems;
import com.OlympiansMod.creativetabs.MCreativeTabs;
import com.OlympiansMod.entity.EntityCell;
import com.OlympiansMod.entity.EntityGreekFire;
import com.OlympiansMod.entity.MEntity;
import com.OlympiansMod.lib.Refstrings;
import com.OlympiansMod.world.MWorld;

import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
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.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = Refstrings.MODID , name = Refstrings.NAME , version = Refstrings.VERSION)
public class MainRegistry {

@SidedProxy(clientSide = Refstrings.CLIENTSIDE , serverSide = Refstrings.SERVERSIDE)
public static ServerProxy proxy;

@Instance
public static MainRegistry modInstance;


@EventHandler
public static void PreLoad(FMLPreInitializationEvent PreEvent) {
	MCreativeTabs.initialiseTabs();
	ModBlocks.MainRegistry();
	MEntity.MainRegistry();
	ModItems.MainRegistry();
	MWorld.MainRegistry();
        CraftingManager.mainRegistry(); 
              

}
@EventHandler
public static void Load(FMLInitializationEvent event) {
	 proxy.registerRenderInfo(); 

}
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent) {

}

}

 

Mob registry: (don't ask about the ids, its not the problem)

package com.OlympiansMod.entity;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;

import com.OlympiansMod.Main.MainRegistry;
import com.sun.xml.internal.bind.v2.model.core.ID;

import cpw.mods.fml.common.registry.EntityRegistry;

public class MEntity {
public static void MainRegistry(){ 
	registerEntity();
}
public static void registerEntity(){
	createEntity(EntityGreekFire.class, "GreekFire");
	createEntity(EntityBullet.class, "Bullet");
	createEntity(EntitySGuardian.class, "SGuardian");
	createEntity(EntitySGolem.class, "SGolem");
	createEntity(EntityUndead.class, "Undead");
	createEntity(EntityUndeadGreekArcher.class, "UndeadArcherGreek");
	createEntity(EntityThunderBolt.class, "ThunderBolt");
	createEntity(EntityMasterBolt.class, "MasterBolt");
	createEntity(Zeus.class, "Zeus");
	createEntity(ZeusExtended.class, "ZeusExtended");
	createEntity(Arachne.class, "Arachne");
	createEntity(EntityCell.class, "EntityCell");
	createEntity(EntityFireBalloDeath.class, "EntityCell");
	createEntity(GreekUndead.class, "GreekUndead");




}
public static void createEntity(Class entityClass, String entityName){

	//int randomID = EntityRegistry.findGlobalUniqueEntityId();
    //EntityRegistry.registerModEntity(entityClass, entityName, randomID, MainRegistry.modInstance, 1, 80, true);
	EntityRegistry.registerModEntity(EntityGreekFire.class, "GreekFire", 4013479, MainRegistry.modInstance, 1, 80, true);
	EntityRegistry.registerModEntity(EntityBullet.class, "Bullet", 302942, MainRegistry.modInstance, 1, 80, true);
	EntityRegistry.registerModEntity(EntitySGuardian.class, "SGaurdian", 301320, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntitySGolem.class, "EntitySGolem", 420193, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityUndead.class, "UndeadRoman", 403998, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityUndeadGreekArcher.class, "UndeadArcherGreek", 403698, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityThunderBolt.class, "ThunderBolt", 413698, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityMasterBolt.class, "MasterBolt", 413798, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(Zeus.class, "Zeus", 414798, MainRegistry.modInstance, 100, 1, true);
	EntityRegistry.registerModEntity(Arachne.class, "Arachne", 414799, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityCell.class, "EntityCell", 414789, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(ZeusExtended.class, "ZeusExtended", 414790, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityFireBalloDeath.class, "EntityFireBalloDeath", 414791, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(GreekUndead.class, "GreekUndead", 414792, MainRegistry.modInstance, 80, 1, true);








}



}




 

Once again thank you for all of your time.

 

Im serious don't look at it!!

Link to comment
Share on other sites

what the heck it worked..

 

package com.OlympiansMod.entity;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;

import com.OlympiansMod.Main.MainRegistry;
import com.sun.xml.internal.bind.v2.model.core.ID;

import cpw.mods.fml.common.registry.EntityRegistry;

public class MEntity {
public static void MainRegistry(){ 
	registerEntity();
}
public static void registerEntity(){
	EntityRegistry.registerModEntity(EntityBullet.class, "Bullet", 302942, MainRegistry.modInstance, 1, 80, true);
	EntityRegistry.registerModEntity(EntitySGuardian.class, "SGaurdian", 301320, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntitySGolem.class, "EntitySGolem", 420193, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityUndead.class, "UndeadRoman", 403998, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityUndeadGreekArcher.class, "UndeadArcherGreek", 403698, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityThunderBolt.class, "ThunderBolt", 413698, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityMasterBolt.class, "MasterBolt", 413798, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(Zeus.class, "Zeus", 414798, MainRegistry.modInstance, 100, 1, true);
	EntityRegistry.registerModEntity(Arachne.class, "Arachne", 414799, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityCell.class, "EntityCell", 414789, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(ZeusExtended.class, "ZeusExtended", 414790, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(EntityFireBalloDeath.class, "EntityFireBalloDeath", 414791, MainRegistry.modInstance, 80, 1, true);
	EntityRegistry.registerModEntity(GreekUndead.class, "GreekUndead", 414792, MainRegistry.modInstance, 80, 1, true);

}
public static void createEntity(Class entityClass, String entityName){

	//int randomID = EntityRegistry.findGlobalUniqueEntityId();
    //EntityRegistry.registerModEntity(entityClass, entityName, randomID, MainRegistry.modInstance, 1, 80, true);








}



}




Im serious don't look at it!!

Link to comment
Share on other sites

Why the hell are you using such high IDs? (

302942

)

 

The ID in registerModEntity is mod-specific, meaning you begin at 0 and count up for each entity.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.