added nature's heal

This commit is contained in:
Ellpeck 2020-02-01 17:22:34 +01:00
parent c63bc43d12
commit 492ea2eec9
6 changed files with 94 additions and 2 deletions

View file

@ -92,7 +92,7 @@ repositories {
}
dependencies {
minecraft 'net.minecraftforge:forge:1.15.2-31.0.4'
minecraft 'net.minecraftforge:forge:1.15.2-31.0.14'
compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api")
runtimeOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2")
@ -102,6 +102,8 @@ dependencies {
runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2")
compileOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2:api")
compile fileTree(dir: 'lib', include: '*.jar')
}
// Example for how to get properties into the manifest for reading by the runtime..

View file

@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.compat;
import com.google.common.collect.ImmutableMap;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.compat.crafttweaker.CraftTweakerCompat;
import de.ellpeck.naturesaura.compat.enchantibility.EnchantibilityCompat;
import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
import de.ellpeck.naturesaura.data.ItemTagProvider;
import net.minecraftforge.fml.ModList;
@ -18,6 +19,7 @@ public final class Compat {
.put("patchouli", PatchouliCompat::new)
.put("curios", CuriosCompat::new)
.put("crafttweaker", CraftTweakerCompat::new)
.put("enchantability", EnchantibilityCompat::new)
.build();
private static final Map<String, ICompat> MODULES = new HashMap<>();

View file

@ -0,0 +1,36 @@
package de.ellpeck.naturesaura.compat.enchantibility;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.TickEvent.PlayerTickEvent;
import quarris.enchantability.api.enchants.AbstractEnchantEffect;
public class EnchantibilityAuraMending extends AbstractEnchantEffect {
public static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "aura_mending");
public EnchantibilityAuraMending(PlayerEntity player, Enchantment enchantment, int level) {
super(player, enchantment, level);
}
public static void onPlayerTick(EnchantibilityAuraMending enchant, PlayerTickEvent event) {
if (event.phase != TickEvent.Phase.END)
return;
if (event.player.world.isRemote || event.player.world.getGameTime() % 10 != 0)
return;
if (!event.player.isShiftKeyDown() || event.player.getHealth() >= event.player.getMaxHealth())
return;
int usage = 5000;
if (NaturesAuraAPI.instance().extractAuraFromPlayer(event.player, usage, false))
event.player.heal(1);
}
@Override
public ResourceLocation getName() {
return RES;
}
}

View file

@ -0,0 +1,34 @@
package de.ellpeck.naturesaura.compat.enchantibility;
import de.ellpeck.naturesaura.compat.ICompat;
import de.ellpeck.naturesaura.data.ItemTagProvider;
import de.ellpeck.naturesaura.enchant.ModEnchantments;
import net.minecraftforge.event.TickEvent.PlayerTickEvent;
import quarris.enchantability.api.EnchantabilityApi;
import quarris.enchantability.api.EnchantabilityApi.IInternals;
import java.util.Collections;
public class EnchantibilityCompat implements ICompat {
@Override
public void preInit() {
IInternals api = EnchantabilityApi.getInstance();
api.registerEnchantEffect(EnchantibilityAuraMending.RES, ModEnchantments.AURA_MENDING, EnchantibilityAuraMending::new);
api.registerEffectComponent(EnchantibilityAuraMending.RES, PlayerTickEvent.class, EnchantibilityAuraMending::onPlayerTick, e -> Collections.singletonList(e.player));
}
@Override
public void preInitClient() {
}
@Override
public void postInit() {
}
@Override
public void addItemTags(ItemTagProvider provider) {
}
}

View file

@ -172,5 +172,6 @@
"entity.naturesaura.effect_inhibitor": "Effect Powder",
"entity.naturesaura.mover_cart": "Aura Attraction Cart",
"enchantment.naturesaura.aura_mending": "Nature's Mend",
"enchantment.naturesaura.aura_mending.desc": "Nature's Aura Enchantment"
"enchantment.naturesaura.aura_mending.desc": "Nature's Aura Enchantment",
"naturesaura:aura_mending.enchant.desc": "Heals the Player Using Aura"
}

View file

@ -0,0 +1,17 @@
{
"name": "Nature's Heal",
"icon": "minecraft:enchanted_book",
"category": "using",
"advancement": "naturesaura:infused_tools",
"flag": "mod:enchantability",
"pages": [
{
"type": "text",
"text": "Any sort of tool being repaired through the use of $(aura) is good and well, until the magical botanist comes in contact with viscious enemies or dangerous heights. At that point, the ability to $(thing)heal oneself$() would certainly be of use."
},
{
"type": "text",
"text": "A $(item)Nature's Mend$() enchanted book, once obtained, can be inserted into an $(item)Ender Chest$()'s enchantment slots to gain the $(item)Nature's Heal$() effect, which will, while $(thing)sneaking$(), top off the user's health slowly while draining $(aura) from an $(aura) container in their inventory."
}
]
}