Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.author.example.lists;
- import com.author.example.Main;
- import net.minecraft.item.Item;
- import net.minecraft.potion.*;
- import net.minecraftforge.fml.RegistryObject;
- import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
- import net.minecraftforge.registries.DeferredRegister;
- import net.minecraftforge.registries.ForgeRegistries;
- import java.lang.reflect.InvocationTargetException;
- import java.lang.reflect.Method;
- public class PotionList {
- public static final DeferredRegister<Effect> EFFECTS = DeferredRegister.create(ForgeRegistries.POTIONS, Main.MOD_ID);
- public static final RegistryObject<Effect> MOD_POTION_EFFECT = EFFECTS.register("mod_potion", () -> new ModPotionEffect(EffectType.BENEFICIAL, 0xabd84e));
- public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTION_TYPES, Main.MOD_ID);
- public static final RegistryObject<Potion> MOD_POTION = POTIONS.register("mod_potion", () -> new Potion(new EffectInstance(MOD_POTION_EFFECT.get(), 600)));
- //.addAttributesModifier(SharedMonsterAttributes.MAX_HEALTH,
- //"", (double)0.5f, AttributeModifier.Operation.MULTIPLY_TOTAL)
- private static Method brewing_mixes;
- private static void addMix(Potion start, Item ingredient, Potion result) {
- if (brewing_mixes == null) {
- brewing_mixes = ObfuscationReflectionHelper.findMethod(PotionBrewing.class, "addMix", Potion.class, Item.class, Potion.class);
- brewing_mixes.setAccessible(true);
- }
- try {
- brewing_mixes.invoke(null, start, ingredient, result);
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e){
- e.printStackTrace();
- }
- }
- public static void addBrewingRecipes() {
- addMix(Potions.AWKWARD, ItemList.MOD_BERRIES.get(), MOD_POTION.get());
- }
- public static class ModPotionEffect extends Effect {
- public ModPotionEffect(EffectType typeIn, int liquidColorIn) {
- super(typeIn, liquidColorIn);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement