package com.thebrokenrail.gulliverreloaded; import com.thebrokenrail.gulliverreloaded.mixin.BrewingRecipeRegistryAccessor; import com.thebrokenrail.gulliverreloaded.mixin.StatusEffectAccessor; import net.fabricmc.api.ModInitializer; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffectType; import net.minecraft.entity.effect.StatusEffects; import net.minecraft.item.Items; import net.minecraft.potion.Potion; import net.minecraft.potion.Potions; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; public class GulliverReloaded implements ModInitializer { public static final String NAMESPACE = "gulliverreloaded"; public static CustomPotion SHRINK_EFFECT; public static CustomPotion GROW_EFFECT; @Override public void onInitialize() { SHRINK_EFFECT = registerEffect("shrink", 2039713); GROW_EFFECT = registerEffect("grow", 16262179); registerBrewingRecipe(); } private CustomPotion registerEffect(String name, int color) { StatusEffect effect = Registry.register(Registry.STATUS_EFFECT, new Identifier(NAMESPACE, name), StatusEffectAccessor.createStatusEffect(StatusEffectType.NEUTRAL, color)); Potion potion = Registry.register(Registry.POTION, new Identifier(NAMESPACE, name), new Potion(new StatusEffectInstance(effect, 3600))); Potion longPotion = Registry.register(Registry.POTION, new Identifier(NAMESPACE, "long_" + name), new Potion(name, new StatusEffectInstance(effect, 9600))); Potion strongPotion = Registry.register(Registry.POTION, new Identifier(NAMESPACE, "strong_" + name), new Potion(name, new StatusEffectInstance(effect, 1800, 1))); return new CustomPotion(effect, potion, longPotion, strongPotion); } private void registerBrewingRecipe() { BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(Potions.AWKWARD, Items.BONE_MEAL, GROW_EFFECT.getPotion()); BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(GROW_EFFECT.getPotion(), Items.REDSTONE, GROW_EFFECT.getLongPotion()); BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(GROW_EFFECT.getPotion(), Items.GLOWSTONE_DUST, GROW_EFFECT.getStrongPotion()); BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(GROW_EFFECT.getPotion(), Items.FERMENTED_SPIDER_EYE, SHRINK_EFFECT.getPotion()); BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(GROW_EFFECT.getLongPotion(), Items.FERMENTED_SPIDER_EYE, SHRINK_EFFECT.getLongPotion()); BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(GROW_EFFECT.getStrongPotion(), Items.FERMENTED_SPIDER_EYE, SHRINK_EFFECT.getStrongPotion()); BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(SHRINK_EFFECT.getPotion(), Items.REDSTONE, SHRINK_EFFECT.getLongPotion()); BrewingRecipeRegistryAccessor.callRegisterPotionRecipe(SHRINK_EFFECT.getPotion(), Items.GLOWSTONE_DUST, SHRINK_EFFECT.getStrongPotion()); } }