diff --git a/docs/scarpet/api/Entities.md b/docs/scarpet/api/Entities.md index 6d37ea3d..31aca4e4 100644 --- a/docs/scarpet/api/Entities.md +++ b/docs/scarpet/api/Entities.md @@ -204,7 +204,7 @@ Entity that `e` rides. ### `query(e, 'unmountable')` -Boolean, true if the entity cannot be mounted. +Boolean, true if the entity cannot be unmounted. ### `(deprecated) query(e, 'tags')` @@ -727,7 +727,7 @@ Mounts the entity to the `other`. ### `modify(e, 'unmountable', boolean)` -Denies or allows an entity to be mounted. +Denies or allows an entity to be unmounted. ### `modify(e, 'drop_passengers')` diff --git a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java index 9c8fa375..0d181f5b 100644 --- a/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java +++ b/src/main/java/carpet/mixins/Player_scarpetEventsMixin.java @@ -18,6 +18,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; import static carpet.script.CarpetEventServer.Event.PLAYER_ATTACKS_ENTITY; import static carpet.script.CarpetEventServer.Event.PLAYER_DEALS_DAMAGE; @@ -86,4 +87,10 @@ public abstract class Player_scarpetEventsMixin extends LivingEntity } } } + + @ModifyReturnValue(method = "wantsToStopRiding", at = @At("TAIL")) + private boolean dontUnmountFromIfPermanentVehicle(boolean original) + { + return original && !((EntityInterface) this.getVehicle()).isPermanentVehicle(); + } }