2020-03-27 03:05:28 +00:00
|
|
|
package com.thebrokenrail.gulliverreloaded;
|
|
|
|
|
|
|
|
import com.thebrokenrail.gulliverreloaded.mixin.BrewingRecipeRegistryAccessor;
|
|
|
|
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.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 {
|
2020-03-27 03:26:14 +00:00
|
|
|
public static final String NAMESPACE = "gulliver-reloaded";
|
2020-03-27 03:05:28 +00:00
|
|
|
|
|
|
|
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) {
|
2020-03-27 03:21:12 +00:00
|
|
|
StatusEffect effect = Registry.register(Registry.STATUS_EFFECT, new Identifier(NAMESPACE, name), new CustomPotion.CustomStatusEffect(StatusEffectType.NEUTRAL, color));
|
2020-03-27 03:05:28 +00:00
|
|
|
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());
|
|
|
|
}
|
|
|
|
}
|