tutorial:status_effects
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:status_effects [2021/09/01 18:47] – Added a new way to create a custom effect banana | tutorial:status_effects [2023/01/12 07:06] (current) – [Registering Status Effect] fix code errors tao0lu | ||
---|---|---|---|
Line 14: | Line 14: | ||
public ExpStatusEffect() { | public ExpStatusEffect() { | ||
super( | super( | ||
- | | + | |
0x98D982); // color in RGB | 0x98D982); // color in RGB | ||
} | } | ||
Line 33: | Line 33: | ||
} | } | ||
} | } | ||
- | </ | ||
- | |||
- | ==== Creating Status Effect Inline ==== | ||
- | If you want to mostly use the StatusEffect class, you may not need an extra class. Using this syntax with '' | ||
- | <code java> | ||
- | InstantStatusEffect BURNING = new InstantStatusEffect(StatusEffectCategory.NEUTRAL, | ||
- | @Override | ||
- | public void applyInstantEffect(@Nullable Entity source, @Nullable Entity attacker, LivingEntity target, int amplifier, double proximity) { | ||
- | if (!target.isSpectator()) { | ||
- | target.setOnFireFromLava(); | ||
- | } | ||
- | }; | ||
</ | </ | ||
Line 56: | Line 44: | ||
@Override | @Override | ||
public void onInitialize() { | public void onInitialize() { | ||
- | Registry.register(Registry.STATUS_EFFECT, | + | Registry.register(Registries.STATUS_EFFECT, |
} | } | ||
} | } |
tutorial/status_effects.1630522022.txt.gz · Last modified: 2021/09/01 18:47 by banana