improved handling of fake players in boats and when pushed by slimeblocks. Fixes #507
This commit is contained in:
1 parent
a6286850b4
commit
9633b402b4
4 files changed
+87
-31
No files matched your search
@@ -1,10 +1,16 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.fakes.EntityInterface;
|
||||
import carpet.patches.EntityPlayerMPFake;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public abstract class EntityMixin implements EntityInterface
|
||||
@@ -14,9 +20,19 @@ public abstract class EntityMixin implements EntityInterface
|
||||
|
||||
@Shadow
|
||||
public float prevYaw;
|
||||
|
||||
|
||||
@Shadow public @Nullable abstract Entity getPrimaryPassenger();
|
||||
|
||||
@Shadow public World world;
|
||||
|
||||
public float getMainYaw(float partialTicks)
|
||||
{
|
||||
return partialTicks == 1.0F ? this.yaw : MathHelper.lerp(partialTicks, this.prevYaw, this.yaw);
|
||||
}
|
||||
|
||||
@Inject(method = "isLogicalSideForUpdatingMovement", at = @At("HEAD"), cancellable = true)
|
||||
private void isFakePlayer(CallbackInfoReturnable<Boolean> cir)
|
||||
{
|
||||
if (getPrimaryPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!world.isClient);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user