Hey so I'm having a little trouble with GUI buttons. I new to GUI and I can't seem to get this to work. I have the button set so that if the player has a poison effect and the button is pressed then it will remove the poison effect. I pressed the button and my players hearts turn from that green color back to a red but the poison effect doesn't actually get removed. This also happens if I try to apply invisibility, it shows the effect in the players inventory but the player isn't actually invisible. Any help would be greatly appreciated.
Here is the code in my GUI class that involves removing the potion effect:
public void initGui()
{
this.buttonList.clear();
int posX = ((this.width - xSOT) / 2);
int posY = ((this.height - ySOT) / 2);
this.buttonList.add(new GuiButton(0, posX + 40, posY + 40, 100, 20, "Remove Posion" ));
}
public void actionPerformed(GuiButton button)
{
switch(button.id)
{
case 0: this.mc.thePlayer.removePotionEffect(Potion.poison.id);
}
}
[/Code]