more stuff #1

Merged
YeahAkis merged 17 commits from YeahAkis/tweaks:main into main 2025-12-03 20:11:54 +01:00
2 changed files with 38 additions and 0 deletions
Showing only changes of commit c82c5f911f - Show all commits

View File

@@ -30,6 +30,12 @@ public class Tweaks implements ModInitializer {
public static final GameRules.Key<GameRules.IntRule> ENDER_EYE_POP_CHANCE = public static final GameRules.Key<GameRules.IntRule> ENDER_EYE_POP_CHANCE =
GameRuleRegistry.register("enderEyePopChance", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(20, 0, 100)); GameRuleRegistry.register("enderEyePopChance", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(20, 0, 100));
public static final GameRules.Key<GameRules.IntRule> LEASH_BREAK_DISTANCE =
GameRuleRegistry.register("leashBreakDistance", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(10, 0, Integer.MAX_VALUE));
public static final GameRules.Key<GameRules.IntRule> LEASH_ELASTIC_DISTANCE =
GameRuleRegistry.register("leashElasticDistance", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(6, 0, Integer.MAX_VALUE));
@Override @Override
public void onInitialize() { public void onInitialize() {
} }

View File

@@ -0,0 +1,32 @@
package systems.brn.tweaks.mixin;
import net.minecraft.entity.Entity;
import net.minecraft.entity.Leashable;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.GameRules;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import systems.brn.tweaks.Tweaks;
@Mixin(Leashable.class)
public interface LeashableMixin {
@ModifyConstant(
method = "tickLeash",
constant = @Constant(doubleValue = 10.0)
)
private static double modifyLeashBreakDistance(double original, ServerWorld world, Entity entity) {
GameRules.IntRule rule = world.getGameRules().get(Tweaks.LEASH_BREAK_DISTANCE);
return rule.get();
}
@ModifyConstant(
method = "tickLeash",
constant = @Constant(doubleValue = 6.0)
)
private static double modifyLeashElasticDistance(double original, ServerWorld world, Entity entity) {
GameRules.IntRule rule = world.getGameRules().get(Tweaks.LEASH_ELASTIC_DISTANCE);
return rule.get();
}
}