Hi! I'm trying to make custom totem of undying, but I don't know how to make its particles, but with different colors. I found 3mptysl's topic, but I didn't understand the solution.
Here's my LivingHurtEvent code:
@SubscribeEvent
public static void owlTotemFunctionality(LivingHurtEvent event) {
if ((event.getEntityLiving().getHealth() - event.getAmount()) < 1) {
LivingEntity entity = event.getEntityLiving();
if (entity.getOffhandItem().getItem() == ModItems.OWL_TOTEM.get()) {
event.setCanceled(true);
entity.setHealth(1);
entity.removeAllEffects();
int duration = 40 * 20; // 1 sec = 20 ticks
int level = 1;
entity.addEffect(new MobEffectInstance(MobEffects.REGENERATION, duration, level));
duration = 5 * 20;
entity.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, duration, level));
duration = 30 * 20;
entity.addEffect(new MobEffectInstance(ModEffects.BLESSING_OF_OWLS.get(), duration));
duration = 40 * 20;
entity.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, duration));
Level plLevel = entity.level;
plLevel.playSound(null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.TOTEM_USE,
SoundSource.PLAYERS, 0.5F, 1F);
Minecraft.getInstance().gameRenderer.displayItemActivation(new ItemStack(ModItems.OWL_TOTEM.get()));
entity.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY);
} else if (entity.getMainHandItem().getItem() == ModItems.OWL_TOTEM.get()) {
event.setCanceled(true);
entity.setHealth(1);
entity.removeAllEffects();
int duration = 40 * 20; // 1 sec = 20 ticks
int level = 1;
entity.addEffect(new MobEffectInstance(MobEffects.REGENERATION, duration, level));
duration = 5 * 20;
entity.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, duration, level));
duration = 30 * 20;
entity.addEffect(new MobEffectInstance(ModEffects.BLESSING_OF_OWLS.get(), duration));
duration = 40 * 20;
entity.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, duration));
Level plLevel = entity.level;
plLevel.playSound(null, entity.getX(), entity.getY(), entity.getZ(), SoundEvents.TOTEM_USE,
SoundSource.PLAYERS, 0.5F, 1F);
Minecraft.getInstance().gameRenderer.displayItemActivation(new ItemStack(ModItems.OWL_TOTEM.get()));
entity.setItemInHand(InteractionHand.MAIN_HAND, ItemStack.EMPTY);
}
}
}
Thank you in advance! ๐