Skip to content

Commit

Permalink
add example skill tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Charismara committed Jan 31, 2024
1 parent ed3d330 commit ae123cb
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import dev.architectury.registry.registries.Registrar;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.ai.attributes.RangedAttribute;
import net.minecraft.world.entity.npc.Villager;
Expand Down Expand Up @@ -54,8 +52,6 @@ public class RegisterTest {
.end();
private static final RegistrySupplier<TestSkill> TEST_SKILL = REGISTER.skill("test_skill", TestSkill::new).end();

static final TagKey<ManasSkill> TEST_SKILL_TAG = TagKey.create(SkillAPI.getSkillRegistryKey(), new ResourceLocation(ManasCore.MOD_ID, "test_skill"));

public static void init() {
ManasCore.Logger.info("Registered test content!");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import net.minecraft.world.entity.projectile.ThrownTrident;
import net.minecraft.world.phys.EntityHitResult;

import static com.github.manasmods.testmod.registry.TestTags.TEST_SKILL_TAG;

public class TestSkill extends ManasSkill {
public TestSkill() {
super(SkillRarity.Unique);
Expand Down Expand Up @@ -105,9 +107,9 @@ public boolean onTouchEntity(ManasSkillInstance instance, LivingEntity owner, Li
}

public boolean onTakenDamage(ManasSkillInstance instance, LivingEntity owner, DamageSource source, Changeable<Float> amount) {
if (instance.is(RegisterTest.TEST_SKILL_TAG)) {
if (instance.is(TEST_SKILL_TAG)) {
owner.heal(amount.get());
ManasCore.Logger.info("Healed {} by {} health", owner.getName(), amount.get());
ManasCore.Logger.info("Healed {} by {} health", owner.getName().getString(), amount.get());
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.github.manasmods.testmod.registry;

import com.github.manasmods.manascore.ManasCore;
import com.github.manasmods.manascore.api.skill.ManasSkill;
import com.github.manasmods.manascore.api.skill.SkillAPI;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;

public class TestTags {
public static final TagKey<ManasSkill> TEST_SKILL_TAG = TagKey.create(SkillAPI.getSkillRegistryKey(), new ResourceLocation(ManasCore.MOD_ID, "test_skill"));
}

0 comments on commit ae123cb

Please sign in to comment.