Jump to content

Recommended Posts

Posted

I'm trying to make my mob move much faster when chasing an entity. However, it seems that mobs have a speed limit that is somewhere around 10 - 30. I've tried every modification I can think of, yet nothing ever makes it go faster than an average sprinting mob. Not even setting the movementSpeed attribute to 6000 will have a noticeable effect.

 

Here is the code I'm currently using:

 

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

	if (this.lastEntityToAttack != this.entityToAttack)
        {
            AttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
            attributeinstance.removeModifier(attackingSpeedBoostModifier);
            this.setSprinting(false);
            

            if (this.entityToAttack != null)
            {
                attributeinstance.applyModifier(attackingSpeedBoostModifier);
                this.setSprinting(true);
            }
        }

	this.lastEntityToAttack = this.entityToAttack;
}

 

Also, just in case you doubt my ability to apply basic attributes, here's that code too:

@Override
    protected void applyEntityAttributes()
    {
    	super.applyEntityAttributes();
    	
    	  // Max Health - default 20.0D - min 0.0D - max Double.MAX_VALUE
    	  this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(50.0D);
    	  
    	  // Knockback Resistance - default 0.0D - min 0.0D - max 1.0D
    	  this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setAttribute(0.5D); 

          // Movement Speed
    	  this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.6D);
    	  
    	  // Attack Damage - default 2.0D - min 0.0D - max Doubt.MAX_VALUE
    	  this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(10.0D);
    	  
    }

(I know this isn't a problem with the attributes themselves because the other ones (health, damage, knockback) work)

 

The speed modifier is copied from EntityEnderman. I know it works because it makes the mob move faster than their movementSpeed attribute if that attribute it is below the max speed.

 

I've been digging through the files for about a week trying to find whatever is causing the movement limit, but I've failed to find anything.

 

https://github.com/code4240/DarwinMod/blob/master/mod/Minecraft/src/code4240/alien/mob/EntityDarwinNeutral.java

I am the Queen/King of gender ambiguity. At least, I try to be.

Posted

Hi

 

I don't know the answer, but have you tried inserting a breakpoint in a couple of key locations and seeing what happens/has happened to your settings?

eg

EntityLivingBase.moveEntityWithHeading

EntityLivingBase.onLivingUpdate

EntityMoveHelper.onUpdateMoveHelper

Entity.moveEntity

PathNavigate.onUpdateNavigation

 

-TGG

 

 

 

Posted

How did you define this ?

attackingSpeedBoostModifier

Maybe your boost is not applied or too much for Minecraft limits.

Also, what parameters did you use when registering your mob ?

Posted

public static double speedModifier = 60D;

private static final UUID attackingSpeedBoostModifierUUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");

    private static final AttributeModifier attackingSpeedBoostModifier = (new AttributeModifier(attackingSpeedBoostModifierUUID, "Attacking speed boost", speedModifier, 0)).setSaved(false);

Like I said, this works when the the regular speed is below the max. It's just that it won't improve it beyond the max.

 

EntityRegistry.registerModEntity(EntityArrowtongue.class, "arrowtongue.entity", arrowtongueID, mod, 80, 1, true);

I am the Queen/King of gender ambiguity. At least, I try to be.

Posted

speedModifier = 60D !?

 

You realize that values greater than about 2 will cause the mob to effectively teleport, right?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

speedModifier = 60D !?

 

You realize that values greater than about 2 will cause the mob to effectively teleport, right?

 

I'm using such a huge value to see if it does anything.

I am the Queen/King of gender ambiguity. At least, I try to be.

Posted

You may be interested in this:

https://github.com/Draco18s/Decaying-World/blob/master/draco18s/decay/entities/EntityFooDog.java

I have several speed modifiers for that entity.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

You may be interested in this:

https://github.com/Draco18s/Decaying-World/blob/master/draco18s/decay/entities/EntityFooDog.java

I have several speed modifiers for that entity.

 

Are you talking about the chunks that look like this?

 

 
                 //this.moveSpeed = 0.28F;
                   this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.28D);
                 //this.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 10, 0));

I am the Queen/King of gender ambiguity. At least, I try to be.

Posted

protected boolean isAIEnabled() {
	return false;
}

Did you change this in your entity, or does any of your parent classes override this ?

 

Or this ?

public float getAIMoveSpeed() {
	return this.isAIEnabled() ? this.landMovementFactor : 0.1F;
}

Posted

protected boolean isAIEnabled() {
	return false;
}

Did you change this in your entity, or does any of your parent classes override this ?

 

Or this ?

public float getAIMoveSpeed() {
	return this.isAIEnabled() ? this.landMovementFactor : 0.1F;
}

 

No, I have not touched those. All I know about those is that I don't have the AI set up, and setting AI to true paralyzes it.

 

also, trying to change the landMovementFactor gives an error because that variable is protected.

I am the Queen/King of gender ambiguity. At least, I try to be.

Posted

You may be interested in this:

https://github.com/Draco18s/Decaying-World/blob/master/draco18s/decay/entities/EntityFooDog.java

I have several speed modifiers for that entity.

 

Are you talking about the chunks that look like this?

 

 
                 //this.moveSpeed = 0.28F;
                   this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.28D);
                 //this.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 10, 0));

 

Yep, those bits.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

You may be interested in this:

https://github.com/Draco18s/Decaying-World/blob/master/draco18s/decay/entities/EntityFooDog.java

I have several speed modifiers for that entity.

 

Are you talking about the chunks that look like this?

 

 
                 //this.moveSpeed = 0.28F;
                   this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.28D);
                 //this.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 10, 0));

 

Yep, those bits.

 

Unless I'm missing something, those are all below the max speed, so this doesn't help me.

I am the Queen/King of gender ambiguity. At least, I try to be.

Posted

I'd just like to point the flaw in this statement:

 

"I am trying to make a mob move faster than the maximum speed."

 

It's called a maximum for a reason.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I'd just like to point the flaw in this statement:

 

"I am trying to make a mob move faster than the maximum speed."

 

It's called a maximum for a reason.

 

I'm trying to CHANGE the maximum speed. I thought I had made that clear already.

I am the Queen/King of gender ambiguity. At least, I try to be.

Posted

I don't think you're going to be doing that through the mob class.

 

You're probably going to have to go higher.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Well, I solved it, sorta. By implementing the new AI system, I was able to overcome the max speed, as the ai system doesn't have a max.

 

Of course, it has a bunch of movement bugs now, but that's for another time.

I am the Queen/King of gender ambiguity. At least, I try to be.

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.