Browse Source

Add MixinRiptideEnchantment

master
Michael Pfaff 12 months ago
parent
commit
942134ecf9
Signed by: michael GPG Key ID: E53B118B12B5C7F9
  1. 16
      src/main/java/dev/pfaff/dense/mixin/MixinRiptideEnchantment.java
  2. 5
      src/main/kotlin/dev/pfaff/dense/DenseConfig.kt
  3. 1
      src/main/resources/dense.mixins.json

16
src/main/java/dev/pfaff/dense/mixin/MixinRiptideEnchantment.java

@ -0,0 +1,16 @@
package dev.pfaff.dense.mixin;
import dev.pfaff.dense.DenseConfig;
import net.minecraft.enchantment.*;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(RiptideEnchantment.class)
public class MixinRiptideEnchantment {
@Inject(method = "getMaxLevel", at = @At("HEAD"), cancellable = true)
public void getMaxLevel(CallbackInfoReturnable<Integer> ci) {
ci.setReturnValue(DenseConfig.getINSTANCE().getTweaks().getEnchanting().getMaxLevels().getRiptide());
}
}

5
src/main/kotlin/dev/pfaff/dense/DenseConfig.kt

@ -88,7 +88,6 @@ class DenseConfig : ConfigData {
@ConfigEntry.BoundedDiscrete(max = 32767, min = 0)
var damage = 5;
// must be 1 less to avoid overflow in formula
@ConfigEntry.BoundedDiscrete(max = 32767, min = 0)
var unbreaking = 3;
@ -99,9 +98,11 @@ class DenseConfig : ConfigData {
@ConfigEntry.BoundedDiscrete(max = 32767, min = 0)
var luck = 3;
// must be 4 less to avoid overflow in formula (if RNG aligns)
@ConfigEntry.BoundedDiscrete(max = 32767, min = 0)
var thorns = 3;
@ConfigEntry.BoundedDiscrete(max = 32767, min = 0)
var riptide = 3;
}
}
}

1
src/main/resources/dense.mixins.json

@ -11,6 +11,7 @@
"MixinEfficiencyEnchantment",
"MixinLuckEnchantment",
"MixinThornsEnchantment",
"MixinRiptideEnchantment",
"MixinPlayerInventory",
"InvokerScreenHandler",
"InvokerEnchantmentScreenHandler",

Loading…
Cancel
Save