Jump to content

Recommended Posts

Posted

My only guess would be maybe you'r adding the potion effect of client side. I could be wrong though.

 

To confirm, log a message in onUpdate that has World.isRemote in it. Tell me what the out put is.

Posted

First, that check for equipped is not needed, the boolean passed to the method already tells you if it is the currently equipped Item. For the animation, do you mean when the shovel is used?

And yes, of course onUpdate will be called on both sides, which is why you need to check.

Yeah the swing animation when its being used doesn't happen... and its only supposed to give you haste when its in the players hand

http://take.ms/Ub8ji

 

Posted

That's really weird... I have no idea what the problem could be...

Posted

1.

First, that check for equipped is not needed, the boolean passed to the method already tells you if it is the currently equipped Item.

 

2. Check if

entity

is an instance of EntityPlayer before proceeding. It may cause mods to crash if they call that method with a non-EntityPlayer as entity.

 

3. The surrounding {}-brackets after the super call are useless. You can remove them saw your edit after I've posted, the 2nd one is right in regards to your brackets

super.onUpdate(...)
if(!worldObj.isRemote) {
    //my code here
}

instead of

super.onUpdate(...)
{
    if(!worldObj.isRemote) {
        //my code here
    }
}

 

4. Please rename your last 2 parametgers to meaningful names. par4 is

slotId

and par5 is called

isEquipped

 

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.

Posted

As SanAndreas mentioned, you MUST check if the entity is a player before proceeding:

if (entity instanceof EntityPlayer && !world.isRemote)

That won't fix your problem, but will prevent crashes later on.

 

What is going on in your super.onUpdate method? Because that call is pointless if it only ends up calling Item#onUpdate, which does nothing.

 

Finally, what exactly is the problem you are having? The potion effect is not getting applied at all, or you are not able to have the swing animation?

 

If you are not able to swing the shovel, can you post your entire shovel class again? It may also have something to do with applying the digSpeed potion specifically (wild guess, but worth a try) - maybe try using a different potion effect like regen that doesn't affect the shovel as its trying to dig.

Posted

Here is the item class.

https://github.com/KaminoCoding/CommuMod/blob/release/V.-1.6_BugFix_%2316/src/main/java/io/cyb3rwarri0r8/commumod/items/ItemRubyShovel.java

 

The swing isn't animating when it digs. It may be something with the potion effect. Let me try changing it and i'll update the post.

 

UPDATE: Sure enough changing the potion to regeneration fixes the animation.. maybe it has to do with the level of dig speed i'm using?

Posted

Don't use speeds of haste higher than about 3, it messes up the swing animation.

I'll put something here when I have something of value I need to put at the end of every post. For now it's this mostly pointless text.

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.