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

@@ -1,11 +1,11 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.world.World;
import net.minecraft.world.entity.Entity;
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;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@@ -17,9 +17,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(LivingEntity.class)
public abstract class LivingEntity_creativeFlyMixin extends Entity
{
@Shadow public float airStrafingSpeed;
@Shadow public float flyingSpeed;
public LivingEntity_creativeFlyMixin(EntityType<?> type, World world)
public LivingEntity_creativeFlyMixin(EntityType<?> type, Level world)
{
super(type, world);
}
@@ -27,9 +27,9 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
@ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.91F), expect = 2)
private float drag(float original)
{
if (CarpetSettings.creativeFlyDrag != 0.09 && (Object)this instanceof PlayerEntity)
if (CarpetSettings.creativeFlyDrag != 0.09 && (Object)this instanceof Player)
{
PlayerEntity self = (PlayerEntity)(Object)(this);
Player self = (Player)(Object)(this);
if (self.getAbilities().flying && ! onGround )
return (float)(1.0-CarpetSettings.creativeFlyDrag);
}
@@ -37,14 +37,14 @@ public abstract class LivingEntity_creativeFlyMixin extends Entity
}
@Inject(method = "getMovementSpeed(F)F", at = @At("HEAD"), cancellable = true)
@Inject(method = "getFrictionInfluencedSpeed(F)F", at = @At("HEAD"), cancellable = true)
private void flyingAltSpeed(float slipperiness, CallbackInfoReturnable<Float> cir)
{
if (CarpetSettings.creativeFlySpeed != 1.0D && (Object)this instanceof PlayerEntity)
if (CarpetSettings.creativeFlySpeed != 1.0D && (Object)this instanceof Player)
{
PlayerEntity self = (PlayerEntity)(Object)(this);
Player self = (Player)(Object)(this);
if (self.getAbilities().flying && !onGround)
cir.setReturnValue( airStrafingSpeed* (float)CarpetSettings.creativeFlySpeed);
cir.setReturnValue( flyingSpeed* (float)CarpetSettings.creativeFlySpeed);
}
}
}