new: CripplingEnchantmentEffect, blindness and weakness
Some checks failed
build / build (push) Failing after 3s
Some checks failed
build / build (push) Failing after 3s
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// 1.21.11 -999999999-01-01T00:00:00 More Spear Enchantments/ModEnchantmentGenerator
|
||||
f288993ccfd4a1a816cceedb4192d4250a1aee2e data/more_spear_enchants/enchantment/poisoning.json
|
||||
26301511d9703bb0aa4f568054802c48bd441405 data/more_spear_enchants/enchantment/thundering.json
|
||||
a05e3914c688a81cb95ed0afed46f7a5149bf228 data/more_spear_enchants/enchantment/withering.json
|
||||
9b422d06a47d72f3038701f2dee8ba2b69f0ae48 data/more_spear_enchants/enchantment/crippling.json
|
||||
5344ffb88ac84ee106698b33d2a371acb43e9e32 data/more_spear_enchants/enchantment/poisoning.json
|
||||
32bf712156f43dd8d319f624514d5a2988cd9ea9 data/more_spear_enchants/enchantment/thundering.json
|
||||
fae6996317beaa6871f6706360cd2f6b4e4d9ab7 data/more_spear_enchants/enchantment/withering.json
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"anvil_cost": 5,
|
||||
"description": {
|
||||
"translate": "enchantment.more_spear_enchants.crippling"
|
||||
},
|
||||
"effects": {
|
||||
"minecraft:post_attack": [
|
||||
{
|
||||
"affected": "victim",
|
||||
"effect": {
|
||||
"type": "more_spear_enchants:crippling",
|
||||
"duration": {
|
||||
"type": "minecraft:linear",
|
||||
"base": 2.0,
|
||||
"per_level_above_first": 1.0
|
||||
}
|
||||
},
|
||||
"enchanted": "attacker"
|
||||
}
|
||||
]
|
||||
},
|
||||
"max_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 15
|
||||
},
|
||||
"max_level": 3,
|
||||
"min_cost": {
|
||||
"base": 1,
|
||||
"per_level_above_first": 10
|
||||
},
|
||||
"slots": [
|
||||
"hand"
|
||||
],
|
||||
"supported_items": "#more_spear_enchants:spears",
|
||||
"weight": 10
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
{
|
||||
"affected": "victim",
|
||||
"effect": {
|
||||
"type": "more_spear_enchants:poisoning_effect",
|
||||
"type": "more_spear_enchants:poison",
|
||||
"duration": {
|
||||
"type": "minecraft:linear",
|
||||
"base": 3.0,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{
|
||||
"affected": "victim",
|
||||
"effect": {
|
||||
"type": "more_spear_enchants:lightning_effect",
|
||||
"type": "more_spear_enchants:lightning",
|
||||
"amount": {
|
||||
"type": "minecraft:linear",
|
||||
"base": 0.4,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{
|
||||
"affected": "victim",
|
||||
"effect": {
|
||||
"type": "more_spear_enchants:withering_effect",
|
||||
"type": "more_spear_enchants:withering",
|
||||
"duration": {
|
||||
"type": "minecraft:linear",
|
||||
"base": 2.0,
|
||||
|
||||
@@ -29,6 +29,11 @@ public class ModEnchantmentEffects {
|
||||
|
||||
public static void registerModEnchantmentEffects() {
|
||||
MoreSpearEnchantments.LOGGER.info("Registering EnchantmentEffects for " + MoreSpearEnchantments.MOD_ID);
|
||||
|
||||
register("lightning", LightningEnchantmentEffect.CODEC);
|
||||
register("poison", PoisonEnchantmentEffect.CODEC);
|
||||
register("withering", WitheringEnchantmentEffect.CODEC);
|
||||
register("crippling", CripplingEnchantmentEffect.CODEC);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ import net.minecraft.enchantment.EnchantmentLevelBasedValue;
|
||||
import net.minecraft.enchantment.effect.EnchantmentEntityEffect;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public record CripplingEnchantmentEffect(EnchantmentLevelBasedValue duartion) implements EnchantmentEntityEffect {
|
||||
public record CripplingEnchantmentEffect(EnchantmentLevelBasedValue duration) implements EnchantmentEntityEffect {
|
||||
public static final MapCodec<CripplingEnchantmentEffect> CODEC = RecordCodecBuilder.mapCodec(instance ->
|
||||
instance.group(
|
||||
EnchantmentLevelBasedValue.CODEC.fieldOf("duration").forGetter(CripplingEnchantmentEffect::duartion)
|
||||
EnchantmentLevelBasedValue.CODEC.fieldOf("duration").forGetter(CripplingEnchantmentEffect::duration)
|
||||
).apply(instance, CripplingEnchantmentEffect::new)
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@ public record CripplingEnchantmentEffect(EnchantmentLevelBasedValue duartion) im
|
||||
public void apply(ServerWorld world, int level, EnchantmentEffectContext context, Entity target, Vec3d pos) {
|
||||
if (target instanceof LivingEntity victim) {
|
||||
if (context.owner() != null && context.owner() instanceof PlayerEntity player) {
|
||||
int Duration = (int) (this.duartion.getValue(level) * 50); // Convert to ticks
|
||||
int Duration = (int) (this.duration.getValue(level) * 50); // Convert to ticks
|
||||
int slownessAmplifier = level - 1; // Level 1 = Slowness 0, Level 2 = Slowness I, Level 3 = Slowness II
|
||||
int weaknessAmplifier = level - 1; // Level 1 = Weakness 0, Level 2 = Weakness I, Level 3 = Weakness II
|
||||
victim.addStatusEffect(new StatusEffectInstance(
|
||||
|
||||
Reference in New Issue
Block a user