feat: initial 1.21.1 mod release
This commit is contained in:
commit
e2896303a7
54 changed files with 1662 additions and 0 deletions
|
|
@ -0,0 +1,58 @@
|
|||
package xyz.nuark.mcmod.fluxedpsi.mixin;
|
||||
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import vazkii.psi.common.core.handler.PlayerDataHandler;
|
||||
import xyz.nuark.mcmod.fluxedpsi.util.PsiCalculationsUtil;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
@Mixin(PlayerDataHandler.PlayerData.class)
|
||||
public abstract class PlayerDataMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
public WeakReference<Player> playerWR;
|
||||
|
||||
@ModifyVariable(
|
||||
method = "deductPsi(IIZZ)V",
|
||||
at = @At("HEAD"),
|
||||
ordinal = 0,
|
||||
argsOnly = true
|
||||
)
|
||||
public int deductPsi(int original) {
|
||||
Player player = playerWR.get();
|
||||
|
||||
int amount = 0;
|
||||
if (player != null) {
|
||||
amount = PsiCalculationsUtil.INSTANCE.deductEnergyFromFluxContainer(player, original);
|
||||
}
|
||||
|
||||
return original - amount;
|
||||
}
|
||||
|
||||
// @Inject(method = "getTotalPsi", at = @At("RETURN"), cancellable = true)
|
||||
// private void getTotalPsi(CallbackInfoReturnable<Integer> cir) {
|
||||
// int totalPsi = cir.getReturnValueI();
|
||||
// Player player = playerWR.get();
|
||||
// if (player != null) {
|
||||
// int attrValue = (int) player.getAttributeValue(ModAttributes.MAX_PSI);
|
||||
// cir.setReturnValue(totalPsi + attrValue);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Inject(method = "getRegenPerTick", at = @At("RETURN"), cancellable = true)
|
||||
// private void getRegenPerTick(CallbackInfoReturnable<Integer> cir) {
|
||||
// int regen = cir.getReturnValueI();
|
||||
// Player player = playerWR.get();
|
||||
// if (player != null) {
|
||||
// int attrValue = (int) player.getAttributeValue(ModAttributes.REGEN_PSI);
|
||||
// cir.setReturnValue(regen + attrValue);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue