Posted March 11, 20187 yr I am creating a simple enemy that attacks the player, but I cannot make him actually deal damage to the player. All he does is run towards the player and make contact with him. No damage is dealt. Code: public EntitySpecGhost(World worldIn) { super(worldIn); this.setSize(1, 2.4f); } @Override protected void initEntityAI() { tasks.addTask(0, new EntityAISwimming(this)); tasks.addTask(1, new EntityAIAttackMelee(this, 2, true)); tasks.addTask(2, new EntityAILookIdle(this)); tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 100)); tasks.addTask(4, new EntityAIWander(this, 1)); targetTasks.addTask(0, new EntityAIHurtByTarget(this, true)); } @Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(15); } @Nullable @Override protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return null; } @Nullable @Override protected SoundEvent getDeathSound() { return null; } @Override protected void playStepSound(BlockPos pos, Block blockIn) { }
March 11, 20187 yr I have a tutorial on this. http://jabelarminecraft.blogspot.com/p/minecraft-forge-1721710-custom-entity.html?m=1 The problem is usually you haven't properly overridden the attack as mob method, depending on what class you extended. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.