specified conditions for creative fly controls

This commit is contained in:
gnembon committed 2020-05-10 00:50:02 -03:00
1 parent 0ad542236c
commit d35769a365
4 files changed
+71 -28

No files matched your search

@@ -28,8 +28,6 @@ public abstract class LivingEntity_scarpetEventsMixin extends Entity implements
@Shadow protected boolean jumping;
@Shadow public float flyingSpeed;
public LivingEntity_scarpetEventsMixin(EntityType<?> type, World world)
{
super(type, world);
@@ -52,29 +50,4 @@ public abstract class LivingEntity_scarpetEventsMixin extends Entity implements
{
return jumping;
}
@ModifyConstant(method = "travel", constant = @Constant(floatValue = 0.91F), expect = 2)
private float drag(float original)
{
if ((Object)this instanceof PlayerEntity)
{
PlayerEntity self = (PlayerEntity)(Object)(this);
if (self.abilities.flying && !onGround)
return (float)CarpetSettings.creativeFlyDrag;
}
return original;
}
@Inject(method = "getMovementSpeed(F)F", at = @At("HEAD"), cancellable = true)
private void flyingAltSpeed(float slipperiness, CallbackInfoReturnable<Float> cir)
{
if ((Object)this instanceof PlayerEntity)
{
PlayerEntity self = (PlayerEntity)(Object)(this);
if (self.abilities.flying && !onGround)
cir.setReturnValue(flyingSpeed* (float)CarpetSettings.creativeFlySpeed);
}
}
}