Skip to content

Commit

Permalink
implement poison and wither effects
Browse files Browse the repository at this point in the history
  • Loading branch information
Badtz committed Mar 5, 2024
1 parent c9d6e7b commit e796390
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 2 deletions.
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"
}

0 comments on commit e796390

Please sign in to comment.