diff --git a/Xplat/src/main/java/vazkii/botania/mixin/PlayerMixin.java b/Xplat/src/main/java/vazkii/botania/mixin/PlayerMixin.java index 093791a5ff..2ac963dd06 100644 --- a/Xplat/src/main/java/vazkii/botania/mixin/PlayerMixin.java +++ b/Xplat/src/main/java/vazkii/botania/mixin/PlayerMixin.java @@ -1,26 +1,20 @@ 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.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; @@ -33,22 +27,6 @@ protected PlayerMixin(EntityType 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; diff --git a/Xplat/src/main/java/vazkii/botania/mixin/ServerPlayerMixin.java b/Xplat/src/main/java/vazkii/botania/mixin/ServerPlayerMixin.java index a42c794042..d4b1fbd07c 100644 --- a/Xplat/src/main/java/vazkii/botania/mixin/ServerPlayerMixin.java +++ b/Xplat/src/main/java/vazkii/botania/mixin/ServerPlayerMixin.java @@ -8,20 +8,45 @@ */ package vazkii.botania.mixin; +import com.mojang.authlib.GameProfile; + +import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; 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 org.spongepowered.asm.mixin.injection.callback.LocalCapture; +import vazkii.botania.common.BotaniaStats; +import vazkii.botania.common.entity.BotaniaEntities; import vazkii.botania.common.handler.EquipmentHandler; import vazkii.botania.common.world.SkyblockWorldEvents; import vazkii.botania.xplat.XplatAbstractions; @Mixin(ServerPlayer.class) -public class ServerPlayerMixin { +public abstract class ServerPlayerMixin extends Player { + protected ServerPlayerMixin(Level level, BlockPos pos, float yRot, GameProfile gameProfile) { + super(level, pos, yRot, gameProfile); + } + + /** + * Updates the distance by luminizer stat + */ + @Inject( + at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/server/level/ServerPlayer;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); + } + } + /** * Setups up a player when spawning into a GoG world for the first time */