Migrate the Carpet codebase to Mojang Mappings

This commit is contained in:
altrisi committed 2022-01-24 20:33:16 +01:00
1 parent a1a2488bc3
commit 06af9ce8b1
346 files changed
+8353 -8492

No files matched your search

+10 -10
View File
@@ -2,9 +2,9 @@ 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 net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -16,23 +16,23 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
public abstract class EntityMixin implements EntityInterface
{
@Shadow
public float yaw;
public float yRot;
@Shadow
public float prevYaw;
public float yRotO;
@Shadow public @Nullable abstract Entity getPrimaryPassenger();
@Shadow public @Nullable abstract Entity getControllingPassenger();
@Shadow public World world;
@Shadow public Level level;
public float getMainYaw(float partialTicks)
{
return partialTicks == 1.0F ? this.yaw : MathHelper.lerp(partialTicks, this.prevYaw, this.yaw);
return partialTicks == 1.0F ? this.yRot : Mth.lerp(partialTicks, this.yRotO, this.yRot);
}
@Inject(method = "isLogicalSideForUpdatingMovement", at = @At("HEAD"), cancellable = true)
@Inject(method = "isControlledByLocalInstance", at = @At("HEAD"), cancellable = true)
private void isFakePlayer(CallbackInfoReturnable<Boolean> cir)
{
if (getPrimaryPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!world.isClient);
if (getControllingPassenger() instanceof EntityPlayerMPFake) cir.setReturnValue(!level.isClientSide);
}
}