Jump to content

[1.10.2] Custom potion effect does not end at zero


Recommended Posts

I am making a library mod to make making my mods easier and I added a test module including a test potion. When I tested it, the effect continued working even after it ran out of time.



package drmeepster.drcorester.potion;

import drmeepster.drcorester.property.PropertyHandler;
import drmeepster.drcorester.util.IBasicObject;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public abstract class BasicPotion extends Potion implements IBasicObject<Potion>{
    //copy these
    //public static final String NAME = "";
    //public static final int COLOR = 0x000000;
    private ResourceLocation icon;
    private String id;

    protected BasicPotion(boolean isBad, int color, String name, String modid) {
        super(true, color);
        this.setPotionName("effect." + PropertyHandler.getName(modid, name));
        this.setRegistryName(modid, name);
        this.setIconIndex(0, 0);
        icon = new ResourceLocation(modid, "textures/potion/" + name + ".png");
        id = name;
    public boolean isReady(int duration, int amplifier){
        return true;
    public boolean hasStatusIcon(){
        return false;
    public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) {
        if (mc.currentScreen != null) {
            Gui.drawModalRectWithCustomSizedTexture(x + 6, y + 7, 0, 0, 18, 18, 18, 18);
    public void renderHUDEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc, float alpha){
        Gui.drawModalRectWithCustomSizedTexture(x + 3, y + 3, 0, 0, 18, 18, 18, 18);
    public String getId(){
        return id;
    /* Copy this:
     * public void performEffect(EntityLivingBase entity, int amplifier){



package drmeepster.drcorester.testing;

import drmeepster.drcorester.ModDrCorester;
import drmeepster.drcorester.potion.BasicPotion;
import net.minecraft.entity.EntityLivingBase;

public class PotionTest extends BasicPotion {

    public static final String NAME = "potion_test";
    public static final int COLOR = 0x000000;
    protected PotionTest() {
        super(false, COLOR, NAME, ModDrCorester.MODID);
    public void performEffect(EntityLivingBase entity, int amplifier){


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.

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.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.