Skip to content

Commit

Permalink
Resistance potion from tortoise scute
Browse files Browse the repository at this point in the history
  • Loading branch information
Uraneptus committed Feb 19, 2024
1 parent d6e474d commit 0dd241d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/generated/resources/assets/sullysmod/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,25 @@
"entity.sullysmod.piranha": "Piranha",
"entity.sullysmod.tortoise": "Tortoise",
"entity.sullysmod.tortoise_shell": "Tortoise Shell",
"item.minecraft.lingering_potion.effect.long_resistance": "Lingering Potion of Resistance",
"item.minecraft.lingering_potion.effect.resistance": "Lingering Potion of Resistance",
"item.minecraft.lingering_potion.effect.strong_resistance": "Lingering Potion of Resistance",
"item.minecraft.lingering_potion.effect.unluck": "Lingering Potion of Bad Luck",
"item.minecraft.potion.effect.long_resistance": "Potion of Resistance",
"item.minecraft.potion.effect.resistance": "Potion of Resistance",
"item.minecraft.potion.effect.strong_resistance": "Potion of Resistance",
"item.minecraft.potion.effect.unluck": "Potion of Bad Luck",
"item.minecraft.smithing_template.jade_upgrade.additions_slot_description": "Add Polished Jade",
"item.minecraft.smithing_template.jade_upgrade.applies_to": "Shield, Diamond Horse Armor",
"item.minecraft.smithing_template.jade_upgrade.base_slot_description": "Add Shield/Horse Armor",
"item.minecraft.smithing_template.jade_upgrade.ingredients": "Polished Jade",
"item.minecraft.splash_potion.effect.long_resistance": "Splash Potion of Resistance",
"item.minecraft.splash_potion.effect.resistance": "Splash Potion of Resistance",
"item.minecraft.splash_potion.effect.strong_resistance": "Splash Potion of Resistance",
"item.minecraft.splash_potion.effect.unluck": "Splash Potion of Bad Luck",
"item.minecraft.tipped_arrow.effect.long_resistance": "Arrow of Resistance",
"item.minecraft.tipped_arrow.effect.resistance": "Arrow of Resistance",
"item.minecraft.tipped_arrow.effect.strong_resistance": "Arrow of Resistance",
"item.minecraft.tipped_arrow.effect.unluck": "Arrow of Bad Luck",
"item.sullysmod.bouldering_zombie_spawn_egg": "Bouldering Zombie Spawn Egg",
"item.sullysmod.cooked_lanternfish": "Cooked Lanternfish",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ protected void ageBoundaryReached() {
}
}

public @NotNull InteractionResult mobInteract(Player pPlayer, @NotNull InteractionHand pHand) {
@NotNull
@Override
public InteractionResult mobInteract(Player pPlayer, @NotNull InteractionHand pHand) {
ItemStack itemInHand = pPlayer.getItemInHand(pHand);
boolean flag = this.isFood(itemInHand) || this.isBaby();

if (flag) {
if (this.isFood(itemInHand) || this.isBaby()) {
return super.mobInteract(pPlayer, pHand);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected void addTranslations() {
forEntity(SMEntityTypes.PIRANHA);

//Potions
addPotionsForEffect(SMPotions.UNLUCK, "Bad Luck");
SMPotions.POTION_TRANSLATIONS.forEach(this::addPotionsForEffect);

//Subtitles
add("subtitles.item.vial.shatter", "Vial shatters");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ public class SMBrewingRecipes {
public static void register() {
DataUtil.addMix(Potions.AWKWARD, SMItems.POLISHED_JADE.get(), Potions.LUCK);
DataUtil.addMix(Potions.LUCK, Items.FERMENTED_SPIDER_EYE, SMPotions.UNLUCK.get());
DataUtil.addMix(Potions.AWKWARD, SMItems.TORTOISE_SCUTE.get(), SMPotions.RESISTANCE.get());
DataUtil.addMix(SMPotions.RESISTANCE.get(), Items.REDSTONE, SMPotions.LONG_RESISTANCE.get());
DataUtil.addMix(SMPotions.RESISTANCE.get(), Items.GLOWSTONE_DUST, SMPotions.STRONG_RESISTANCE.get());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,22 @@
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;

public class SMPotions {
public static final DeferredRegister<Potion> POTIONS = DeferredRegister.create(ForgeRegistries.POTIONS, SullysMod.MOD_ID);
public static Map<Supplier<? extends Potion>, String> POTION_TRANSLATIONS = new HashMap<>();

public static final RegistryObject<Potion> UNLUCK = register("unluck", "Bad Luck", new MobEffectInstance(MobEffects.UNLUCK, 6000));
public static final RegistryObject<Potion> RESISTANCE = register("resistance", "Resistance", new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 3600));
public static final RegistryObject<Potion> LONG_RESISTANCE = register("long_resistance", "Resistance", new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 9600));
public static final RegistryObject<Potion> STRONG_RESISTANCE = register("strong_resistance", "Resistance", new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 1800, 1));

public static final RegistryObject<Potion> UNLUCK = POTIONS.register("unluck", () -> new Potion("unluck", new MobEffectInstance(MobEffects.UNLUCK, 6000)));
public static RegistryObject<Potion> register(String name, String translation, MobEffectInstance... instances) {
RegistryObject<Potion> potion = POTIONS.register(name, () -> new Potion(name, instances));
POTION_TRANSLATIONS.put(potion, translation);
return potion;
}
}

0 comments on commit 0dd241d

Please sign in to comment.