Merge branch 'master' into 1.16

This commit is contained in:
gnembon committed 2020-05-13 10:37:27 -03:00
commit 903fe1e31a
5 files changed
+25 -20

No files matched your search

+10 -5
View File
@@ -33,7 +33,7 @@ import static carpet.settings.RuleCategory.CLIENT;
@SuppressWarnings("CanBeFinal")
public class CarpetSettings
{
public static final String carpetVersion = "1.3.22+v200506";
public static final String carpetVersion = "1.3.23+v200513";
public static final Logger LOG = LogManager.getLogger();
public static boolean skipGenerationChecks = false;
public static boolean impendingFillSkipUpdates = false;
@@ -608,18 +608,23 @@ public class CarpetSettings
"having it set on the decicated server has no effect",
"but this also means it will work on vanilla servers as well"
},
category = {CREATIVE, CLIENT}
category = {CREATIVE, CLIENT},
validate = Validator.NONNEGATIVE_NUMBER.class
)
public static double creativeFlySpeed = 1.0f;
public static double creativeFlySpeed = 1.0;
@Rule(
desc = "Creative air drag",
extra = {
"Increased drag will slow down your flight",
"So need to adjust speed accordingly",
"With 1.0 drag, using speed of 11 seems to matching vanilla speeds.",
"Purely client side setting, meaning that",
"having it set on the decicated server has no effect",
"but this also means it will work on vanilla servers as well"
},
category = {CREATIVE, CLIENT}
category = {CREATIVE, CLIENT},
validate = Validator.PROBABILITY.class
)
public static double creativeFlyDrag = 0.91f;
public static double creativeFlyDrag = 0.09;
}
@@ -27,11 +27,11 @@ 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.91D && (Object)this instanceof PlayerEntity)
if (CarpetSettings.creativeFlyDrag != 0.09 && (Object)this instanceof PlayerEntity)
{
PlayerEntity self = (PlayerEntity)(Object)(this);
if (self.abilities.flying && ! onGround )
return (float)CarpetSettings.creativeFlyDrag;
return (float)(1.0-CarpetSettings.creativeFlyDrag);
}
return original;
}
+11 -11
View File
@@ -17,17 +17,6 @@ public abstract class Validator<T>
public abstract T validate(ServerCommandSource source, ParsedRule<T> currentRule, T newValue, String string);
public String description() {return null;}
public static class POSITIVE_NUMBER<T extends Number> extends Validator<T>
{
@Override
public T validate(ServerCommandSource source, ParsedRule<T> currentRule, T newValue, String string)
{
return newValue.doubleValue() > 0 ? newValue : null;
}
@Override
public String description() { return "Must be a positive number"; }
}
public static class _COMMAND<T> extends Validator<T>
{
@Override
@@ -119,4 +108,15 @@ public abstract class Validator<T>
@Override
public String description() { return "Must be a positive number";}
}
public static class PROBABILITY <T extends Number> extends Validator<T>
{
@Override
public T validate(ServerCommandSource source, ParsedRule<T> currentRule, T newValue, String string)
{
return (newValue.doubleValue() >= 0 && newValue.doubleValue() <= 1 )? newValue : null;
}
@Override
public String description() { return "Must be between 0 and 1";}
}
}