Jump to content

Custom PotionEffect Do Not Disappear in Client Side


zerozhou

Recommended Posts

I'm dealing with some custom potioneffects. As there are a lot of potioneffects I'm going to implement, I use reflect to expand the potion list which origin size is 32.

Things seem to be fine but when I try to render the effects in the client side, I found that the potioneffect did not disappear in the client side, that I try to render the effect all the time after the entity get the effect.

It seems the client would receive a packet about the disappearance of the potioneffect, but as you can see, I don't think it works well. Maybe there are some strange feature handling the potioneffects? Like the packet only send with ID less then 32 or something.

Could someone help?

Link to comment
Share on other sites

Yes I change the onUpdate like what the SRC do in the code.

Decrease the duration of the effect.


public boolean onUpdate(EntityLivingBase par1)
    {
        if (this.duration > 0)
        {
            this.deincrementDuration();
        }
        par1.addPotionEffect(new PotionEffect(8, 2, -8, false));
        AttributeInstance atins = par1.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
        AttributeModifier mod = new AttributeModifier(Utils.MyFreezeSpeed,"Freeze",-1.0F,2);
        if (atins.getModifier(Utils.MyFreezeSpeed) == null) {
        	atins.applyModifier(mod);
        }
        if (this.duration % 140 == 0) {
        	par1.attackEntityFrom(new MyDamageSource("FreezeDamage", null, 7, 2.0F), 2.0F);
        }
        return this.duration > 0;
    }

Link to comment
Share on other sites

OK I got it, as the when the entity(not player)'s potioneffet disappear, there is no packet from the server to the client. But the server tracks the player's potioneffet status. So I send packet to the player around the entity I'm handling slove the problem.

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.