Jump to content

Search the Community

Showing results for tags 'potions'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Minecraft Forge
    • Releases
    • Support & Bug Reports
    • Suggestions
    • General Discussion
  • Mod Developer Central
    • Modder Support
    • User Submitted Tutorials
  • Non-Forge
    • Site News (non-forge)
    • Minecraft General
    • Off-topic
  • Forge Mods
    • Mods

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


XMPP/GTalk


Gender


URL


Location


ICQ


AIM


Yahoo IM


MSN Messenger


Personal Text

Found 4 results

  1. Hello, new coder and first time posting, sorry if I get stuff wrong Been having a really difficult time trying to figure out this potion effect. I want to give a potion effect that denies the wither effect on the player. I've looked over a lot of different tutorials, and through some other mods and made something that sort of works but it was based on applyEffectTick and the players would still take a tick of damage before the potion effect kicked in. When looking up other ways to do this I saw there was like the PotionEvent but whenever I try to use it, I get errors of how it cannot be defined. This is my code right now that doesn't work package io.github.AndroPups.tsmp_models.effect; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.LivingEntity; public class NoWitherEffect extends MobEffect { public NoWitherEffect(MobEffectCategory mobEffectCategory, int color) { super(mobEffectCategory.BENEFICIAL, color); } public static void onPotionAdded(PotionEvent.PotionAddedEvent event) { LivingEntity entity = event.getEntityLiving(); MobEffect potionEffect = event.getPotionEffect().getEffect(); if (potionEffect == MobEffects.WITHER); { entity.removeEffect(MobEffects.WITHER); } } @Override public boolean isDurationEffectTick(int duration, int amplifier) { return true; } } And this code works but occasionally still applies damage because of ticking effect. package io.github.AndroPups.tsmp_models.effect; import net.minecraft.world.effect.MobEffect; import net.minecraft.world.effect.MobEffectCategory; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.LivingEntity; public class NoWitherEffect extends MobEffect { public NoWitherEffect(MobEffectCategory mobEffectCategory, int color) { super(mobEffectCategory.BENEFICIAL, color); } @Override public void applyEffectTick(LivingEntity pLivingEntity, int pAmplifier) { if (!pLivingEntity.level().isClientSide()) { if (pLivingEntity.hasEffect(MobEffects.WITHER)); { pLivingEntity.getEffect(MobEffects.WITHER); } } } @Override public boolean isDurationEffectTick(int duration, int amplifier) { return true; } } I've tried to see if PotionEvent was removed from recent Forge updates but can't really find any information on it. Any information at all would be helpful! Thanks! EDIT: I found a solution, instead of trying to stop the effects I instead made an event that applies effects to the player in the water then made a potion that when it's active the water event would just skip the negative effects. A lot more simpler to use than my round about code. Works like a dream.
  2. In 1.20.6 any potion brewed in the brewing stand disappears upon completion.
  3. package com.example.examplemod; import net.minecraftforge.registries.ForgeRegistries; import java.rmi.registry.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.Potion; import net.minecraft.world.item.alchemy.Potions; public class CustomPotion{ public static final Potion witherPotion = Registry.register(Registry.POTION, new Identifier("tutorial", "Witherpotion"), new Potion(new MobEffectInstance(MobEffects.WITHER, 3600, 1))); public static void registerPotions(){ } public static void registerPotionsRecipes(){ BrewingRecipeRegistryMixin.invokeRegisterPotionRecipe(Potions.AWKWARD, Items.WITHER_ROSE, CustomPotion.witherPotion); } } The errors are: POTION cannot be resolved or is not a field CustomPotion.java Identifier cannot be resolved to a type CustomPotion.java
×
×
  • Create New...

Important Information

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