Fabric-Tutorial-1.18.1 icon indicating copy to clipboard operation
Fabric-Tutorial-1.18.1 copied to clipboard

Please fix bug in status effects registry class

Open SirEnder125 opened this issue 2 years ago • 4 comments

Hey!! Just noticed while watching your tutorial on StatusEffects that you always return a new FreezeEffect(...) in your register method. The code to which I am referring:

package net.kaupenjoe.tutorialmod.effect;

import net.kaupenjoe.tutorialmod.TutorialMod;
import net.minecraft.entity.effect.StatusEffect;
import net.minecraft.entity.effect.StatusEffectCategory;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

public class ModEffects {
    public static StatusEffect FREEZE;

    public static StatusEffect registerStatusEffect(String name) {
        return Registry.register(Registry.STATUS_EFFECT, new Identifier(TutorialMod.MOD_ID, name),
                new FreezeEffect(StatusEffectCategory.HARMFUL, 3124687));
    }

    public static void registerEffects() {
        FREEZE = registerStatusEffect("freeze");
    }
}

Not too much of a java pro, but I've seen such code as this usually replaced with type arguments. Just thought I'd point this out. (It may have been intentional, just not sure. 🤔) :smile:

[EDIT] Hmmm. Now that I think about it, I guess this should have been a pull request...

SirEnder125 avatar Apr 11 '22 06:04 SirEnder125