added ability set unmountable entities

This commit is contained in:
gnembon committed 2020-02-10 01:52:08 -04:00
1 parent 229a82da90
commit ee4a073a57
4 files changed
+37

No files matched your search

@@ -1,5 +1,6 @@
package carpet.mixins;
import carpet.fakes.EntityInterface;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -53,4 +54,14 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
{
STATISTICS.onPlayerStatistic((ServerPlayerEntity) (Object)this, stat, amount);
}
@Redirect(method = "method_14218", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerEntity;setSneaking(Z)V"
))
private void setSneakingConditionally(ServerPlayerEntity serverPlayerEntity, boolean sneaking)
{
if (!((EntityInterface)serverPlayerEntity.getVehicle()).isPermanentVehicle()) // won't since that method makes sure its not null
serverPlayerEntity.setSneaking(sneaking);
}
}