more stuff #1

Merged
YeahAkis merged 17 commits from YeahAkis/tweaks:main into main 2025-12-03 20:11:54 +01:00
4 changed files with 56 additions and 1 deletions
Showing only changes of commit 75fed26c3c - Show all commits

View File

@@ -27,6 +27,9 @@ public class Tweaks implements ModInitializer {
public static final GameRules.Key<GameRules.IntRule> ENDER_PEARL_DIVERGENCE =
GameRuleRegistry.register("enderPearlDivergence", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(100, 0, Integer.MAX_VALUE));
public static final GameRules.Key<GameRules.IntRule> ENDER_EYE_POP_CHANCE =
GameRuleRegistry.register("enderEyePopChance", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(20, 0, 100));
@Override
public void onInitialize() {
}

View File

@@ -0,0 +1,39 @@
package systems.brn.tweaks.mixin;
import net.minecraft.entity.EyeOfEnderEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
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.CallbackInfo;
import systems.brn.tweaks.Tweaks;
import systems.brn.tweaks.mixin.accessors.EyeOfEnderEntityAccessor;
@Mixin(EyeOfEnderEntity.class)
public class EyeOfEnderMixin {
@Inject(
method = "initTargetPos",
at = @At(
value = "FIELD",
target = "Lnet/minecraft/entity/EyeOfEnderEntity;dropsItem:Z",
ordinal = 0,
shift = At.Shift.AFTER
)
)
private void applyCustomBreakChance(CallbackInfo ci) {
EyeOfEnderEntity self = (EyeOfEnderEntity)(Object)this;
World world = self.getWorld();
if (!(world instanceof ServerWorld serverWorld))
return;
int popChance = serverWorld.getGameRules().getInt(Tweaks.ENDER_EYE_POP_CHANCE);
int roll = self.getRandom().nextInt(100);
boolean dropsItem = roll >= popChance;
((EyeOfEnderEntityAccessor) self).setDropsItem(dropsItem);
}
}

View File

@@ -0,0 +1,11 @@
package systems.brn.tweaks.mixin.accessors;
import net.minecraft.entity.EyeOfEnderEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(EyeOfEnderEntity.class)
public interface EyeOfEnderEntityAccessor {
@Accessor("dropsItem")
void setDropsItem(boolean value);
}

View File

@@ -7,9 +7,11 @@
"CreeperEntityMixin",
"DontHurtMePearlMixin",
"EnderPearlItemMixin",
"EyeOfEnderMixin",
"JustTeleportAlreadyMixin",
"PlayerEntityMixin",
"accessors.CreeperEntityAccessor"
"accessors.CreeperEntityAccessor",
"accessors.EyeOfEnderEntityAccessor"
],
"injectors": {
"defaultRequire": 1