- 11
- 1
Как можно сделать так, чтобы при съедании предмета накладывался дебаф на игрока?
Вот код с инициализацией пойза
Вот код с инициализацией пойза
PotionInit:
package cloudninja.packag.init;
import cloudninja.packag.potions.CustomPotion;
import cloudninja.packag.register.ItemRegistry;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.init.Items;
import net.minecraft.init.PotionTypes;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.PotionHelper;
import net.minecraft.potion.PotionType;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
public class PotionInit {
public static final Potion MY_POTION_EFFECT = new CustomPotion("my_potion", false,10514519,0,0).registerPotionAttributeModifier(SharedMonsterAttributes.KNOCKBACK_RESISTANCE, MathHelper.getRandomUUID().toString(), 3.0D, 2);
public static final PotionType MY_POTION = new PotionType("my_potion", new PotionEffect[] {new PotionEffect(MY_POTION_EFFECT,1200)}).setRegistryName("my_potion");
public static final PotionType LONG_MY_POTION = new PotionType("my_potion", new PotionEffect[] {new PotionEffect(MY_POTION_EFFECT,1200)}).setRegistryName("long_my_potion");
public static void registerPotions(){
registerPotion(MY_POTION,LONG_MY_POTION,MY_POTION_EFFECT);
registerPotionMixes();
}
private static void registerPotion(PotionType defaultPotion,PotionType longPotion,Potion effect)
{
ForgeRegistries.POTIONS.register(effect);
ForgeRegistries.POTION_TYPES.register(defaultPotion);
ForgeRegistries.POTION_TYPES.register(longPotion);
}
private static void registerPotionMixes ()
{
PotionHelper.addMix(MY_POTION, ItemRegistry.COCONUT,LONG_MY_POTION);
PotionHelper.addMix(PotionTypes.SLOWNESS, ItemRegistry.COCONUT, MY_POTION);
}
}