DrMeepster Posted March 4, 2017 Posted March 4, 2017 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. BasicPotion: Spoiler 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"); System.out.println(icon); id = name; } @Override public boolean isReady(int duration, int amplifier){ return true; } @Override public boolean hasStatusIcon(){ return false; } @SideOnly(Side.CLIENT) @Override public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) { if (mc.currentScreen != null) { mc.getTextureManager().bindTexture(icon); Gui.drawModalRectWithCustomSizedTexture(x + 6, y + 7, 0, 0, 18, 18, 18, 18); } } @SideOnly(Side.CLIENT) @Override public void renderHUDEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc, float alpha){ mc.getTextureManager().bindTexture(icon); Gui.drawModalRectWithCustomSizedTexture(x + 3, y + 3, 0, 0, 18, 18, 18, 18); } @Override public String getId(){ return id; } /* Copy this: * public void performEffect(EntityLivingBase entity, int amplifier){ */ } PotionTest: Spoiler 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); } @Override public void performEffect(EntityLivingBase entity, int amplifier){ entity.setFire(1); } } Quote
DrMeepster Posted March 4, 2017 Author Posted March 4, 2017 ??????? I commented out the line that sets the player on fire and uncommented it and it started working. Quote
Recommended Posts
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.