Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separation of AncientWillContainer and TerrasteelHelmItem #4749

Open
wants to merge 5 commits into
base: 1.21.1-porting
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
merge into 1.21.1
  • Loading branch information
megadoxs committed Nov 2, 2024
commit f712540666a2dd5bf0fe6950a7c4b7b92b7cd187
22 changes: 21 additions & 1 deletion Xplat/src/main/java/vazkii/botania/mixin/PlayerMixin.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
package vazkii.botania.mixin;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import vazkii.botania.api.item.AncientWillContainer;
import vazkii.botania.common.BotaniaStats;
import vazkii.botania.common.PlayerAccess;
import vazkii.botania.common.entity.BotaniaEntities;
import vazkii.botania.common.item.ResoluteIvyItem;
import vazkii.botania.common.item.equipment.armor.terrasteel.TerrasteelHelmItem;

@Mixin(Player.class)
public abstract class PlayerMixin extends LivingEntity implements PlayerAccess {
@@ -29,6 +33,22 @@ protected PlayerMixin(EntityType<? extends LivingEntity> type, Level level) {
@Unique
private LivingEntity terraWillCritTarget;

@Shadow
public abstract void awardStat(ResourceLocation stat, int i);

/**
* Updates the distance by luminizer stat
*/
@Inject(
at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/world/entity/player/Player;getVehicle()Lnet/minecraft/world/entity/Entity;"),
method = "checkRidingStatistics", locals = LocalCapture.CAPTURE_FAILSOFT
)
private void trackLuminizerTravel(double dx, double dy, double dz, CallbackInfo ci, int cm, Entity mount) {
if (mount.getType() == BotaniaEntities.PLAYER_MOVER) {
awardStat(BotaniaStats.LUMINIZER_ONE_CM, cm);
}
}

@Override
public void botania$setCritTarget(LivingEntity entity) {
this.terraWillCritTarget = entity;
You are viewing a condensed version of this merge commit. You can view the full changes here.