fix players picking up items in contraption bounds when seated

This commit is contained in:
TropheusJ 2025-02-20 09:37:21 -05:00
parent f8b3da4d81
commit 58af7aaa4b
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,35 @@
package com.simibubi.create.foundation.mixin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.simibubi.create.content.contraptions.AbstractContraptionEntity;
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;
@Mixin(Player.class)
public abstract class PlayerMixin extends LivingEntity {
protected PlayerMixin(EntityType<? extends LivingEntity> entityType, Level level) {
super(entityType, level);
}
@ModifyExpressionValue(
method = "aiStep",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/player/Player;isPassenger()Z"
)
)
private boolean pretendNotPassenger(boolean isPassenger) {
// avoid touching all items in the contraption's massive hitbox
if (isPassenger && this.getVehicle() instanceof AbstractContraptionEntity) {
return false;
}
return isPassenger;
}
}

View file

@ -16,6 +16,7 @@
"LavaSwimmingMixin", "LavaSwimmingMixin",
"LootingEnchantFunctionMixin", "LootingEnchantFunctionMixin",
"MapItemSavedDataMixin", "MapItemSavedDataMixin",
"PlayerMixin",
"ProjectileUtilMixin", "ProjectileUtilMixin",
"ShulkerBoxBlockMixin", "ShulkerBoxBlockMixin",
"SmithingMenuMixin", "SmithingMenuMixin",