mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
fix players picking up items in contraption bounds when seated
This commit is contained in:
parent
f8b3da4d81
commit
58af7aaa4b
2 changed files with 36 additions and 0 deletions
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,6 +16,7 @@
|
||||||
"LavaSwimmingMixin",
|
"LavaSwimmingMixin",
|
||||||
"LootingEnchantFunctionMixin",
|
"LootingEnchantFunctionMixin",
|
||||||
"MapItemSavedDataMixin",
|
"MapItemSavedDataMixin",
|
||||||
|
"PlayerMixin",
|
||||||
"ProjectileUtilMixin",
|
"ProjectileUtilMixin",
|
||||||
"ShulkerBoxBlockMixin",
|
"ShulkerBoxBlockMixin",
|
||||||
"SmithingMenuMixin",
|
"SmithingMenuMixin",
|
||||||
|
|
Loading…
Add table
Reference in a new issue