1.18的buff效果制作和1.16.5的极为相似,只是一些函数的命名与1.16.5buff教程有所不同。
1.我们首先新建一个effects包,包内新建一个效果基类BaseEffect
BaseEffect.java
package com.joy187.re8joymod.effects;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.entity.LivingEntity;
public class BaseEffect extends MobEffect{
private boolean instant;
private boolean isRegistered = false;
protected float resistancePerLevel = 0.5f;//for any buff
public BaseEffect(MobEffectCategory type, int color, boolean isInstant) {
super(type, color);
this.instant = isInstant;
}
public boolean isInstantenous() {
return false;
}
@Override
public boolean isDurationEffectTick(int remainin

本文介绍了如何在Minecraft 1.18中通过Java编程实现一个名为'EffectBurn'的自定义buff,该效果使玩家移动速度降低并每段时间遭受伤害。教程包括创建BaseEffect基类,子类EffectBurn的实现,以及如何在项目中注册和配置。
最低0.47元/天 解锁文章
4606





