So i've started Forge coding for a couple weeks now, and I've been getting into Key Inputs, with handlers and all that.
Recently, i've been trying to develop a keyinput where you click a key, and you would get a certain effect. When I did use the player.addPotionEffect() method though, the client only visualizes the effect, but doesn't actually work.
Here's a snippet of my code:
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
EntityPlayer play = Minecraft.getMinecraft().thePlayer;
if(testKey.ping.isPressed()) {
buttonPress = true;
if(play!=null){
if(XPowerFlask.ability==0) {
play.addPotionEffect(new PotionEffect(Potion.damageBoost.getId(), 1000, 2));
In addition, I'd like to create a cooldown on the effect. Every time I add the onUpdate() method though, the ability works, then the cooldown just never seems to actually work.
Thanks in advance!