Experience orbs grant saturation
This commit is contained in:
parent
509367b7a9
commit
05df5ca4b2
|
|
@ -1,4 +1,4 @@
|
|||
# Done to increase the memory available to gradle.
|
||||
# Done to increase the memory available to Gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
org.gradle.parallel=true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
package xyz.nearmisses.patience.mc_rebalance.mixin;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
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;
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
public class ExampleMixin {
|
||||
@Inject(at = @At("HEAD"), method = "loadLevel")
|
||||
private void init(CallbackInfo info) {
|
||||
// This code is injected into the start of MinecraftServer.loadLevel()V
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package xyz.nearmisses.patience.mc_rebalance.mixin;
|
||||
|
||||
import net.minecraft.world.entity.ExperienceOrb;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.food.FoodData;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ExperienceOrb.class)
|
||||
public abstract class ExperienceOrbRework {
|
||||
@Shadow
|
||||
public abstract int getValue();
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "playerTouch")
|
||||
private void playerTouch(Player player, CallbackInfo ci) {
|
||||
// This code is injected into the start of ExperienceOrb.playerTouch()
|
||||
FoodData hunger = player.getFoodData();
|
||||
hunger.setSaturation(hunger.getSaturationLevel() + getValue()*0.115f); // Placeholder value but it'll do
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"required": true,
|
||||
"package": "xyz.nearmisses.patience.mc_rebalance.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"ExampleMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"overwrites": {
|
||||
"requireAnnotations": true
|
||||
"required": true,
|
||||
"package": "xyz.nearmisses.patience.mc_rebalance.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"ExperienceOrbRework"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"overwrites": {
|
||||
"requireAnnotations": true
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue