Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement poison and wither effects #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/me/woach/bone/effects/BoneEffectRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public enum BoneEffectRegistry {
SPIKE("spike", () -> new SpikeEffect()),
HIGH_JUMP("high_jump", () -> new HighJumpEffect()),
SLOW_FALL("slow_fall", () -> new SlowFallEffect()),
DOLPHIN_KICK("dolphin_kick", () -> new DolphinKickEffect());
DOLPHIN_KICK("dolphin_kick", () -> new DolphinKickEffect()),
POISON("poison", () -> new PoisonEffect()),
WITHER("wither", () -> new WitherEffect());

private final String path;
private final Supplier<BoneEffect> effectSupplier;
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/me/woach/bone/effects/PoisonEffect.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package me.woach.bone.effects;

import me.woach.bone.effects.bonetype.GenericBoneType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;

public class PoisonEffect extends BoneEffect {
public PoisonEffect() {
super(Rarity.RARE, new GenericBoneType(), EquipmentSlot.MAINHAND);
}

@Override
public void onTargetDamaged(LivingEntity user, Entity target, int level) {
if (target instanceof LivingEntity) {
((LivingEntity) target)
.addStatusEffect(new StatusEffectInstance(StatusEffects.POISON, (level + 1) * 20, level,
false, true, false));
}
super.onTargetDamaged(user, target, level);
}
}
24 changes: 24 additions & 0 deletions src/main/java/me/woach/bone/effects/WitherEffect.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package me.woach.bone.effects;

import me.woach.bone.effects.bonetype.GenericBoneType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;

public class WitherEffect extends BoneEffect {
public WitherEffect() {
super(Rarity.RARE, new GenericBoneType(), EquipmentSlot.MAINHAND);
}

@Override
public void onTargetDamaged(LivingEntity user, Entity target, int level) {
if (target instanceof LivingEntity) {
((LivingEntity) target)
.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, (level + 1) * 20, level,
false, true, false));
}
super.onTargetDamaged(user, target, level);
}
}
4 changes: 3 additions & 1 deletion src/main/resources/assets/bone/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@
"enchantment.bone.spike": "Spike",
"enchantment.bone.high_jump": "High Jump",
"enchantment.bone.slow_fall": "Slow Fall",
"enchantment.bone.dolphin_kick": "Dolphin Kick"
"enchantment.bone.dolphin_kick": "Dolphin Kick",
"enchantment.bone.poison": "Poison",
"enchantment.bone.wither": "Wither"
}
9 changes: 9 additions & 0 deletions src/main/resources/data/bone/bones/wither_skeleton.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"enabled": true,
"chance": 125,
"effects": {
"WEAPON": "bone:wither",
"DIGGER": "bone:wither"
},
"entity": "minecraft:wither_skeleton"
}
9 changes: 9 additions & 0 deletions src/main/resources/data/bone/bones/zombie_villager.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"enabled": true,
"chance": 125,
"effects": {
"WEAPON": "bone:poison",
"DIGGER": "bone:poison"
},
"entity": "minecraft:zombie_villager"
}
Loading