Merge branch 'master' into 1.15

# Conflicts:
#	src/main/java/carpet/mixins/TntEntityMixin.java
#	src/main/java/carpet/script/value/EntityValue.java
This commit is contained in:
gnembon committed 2019-10-23 08:58:57 -03:00
commit f41ae0f00e
16 files changed
+848 -13

No files matched your search

@@ -17,13 +17,7 @@ import net.minecraft.world.dimension.DimensionType;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import static carpet.settings.RuleCategory.BUGFIX;
import static carpet.settings.RuleCategory.COMMAND;
import static carpet.settings.RuleCategory.CREATIVE;
import static carpet.settings.RuleCategory.EXPERIMENTAL;
import static carpet.settings.RuleCategory.FEATURE;
import static carpet.settings.RuleCategory.OPTIMIZATION;
import static carpet.settings.RuleCategory.SURVIVAL;
import static carpet.settings.RuleCategory.*;
public class CarpetSettings
{
@@ -89,9 +83,59 @@ public class CarpetSettings
@Rule( desc = "Explosions won't destroy blocks", category = CREATIVE )
public static boolean explosionNoBlockDamage = false;
@Rule( desc = "Removes random TNT momentum when primed", category = CREATIVE )
@Rule( desc = "Removes random TNT momentum when primed", category = {CREATIVE, TNT} )
public static boolean tntPrimerMomentumRemoved = false;
@Rule( desc = "TNT causes less lag when exploding in the same spot and in liquids", category = TNT)
public static boolean optimizedTNT = false;
private static class CheckOptimizedTntEnabledValidator<T> extends Validator<T> {
@Override
public T validate(ServerCommandSource source, ParsedRule<T> currentRule, T newValue, String string) {
return optimizedTNT || currentRule.defaultValue.equals(newValue) ? newValue : null;
}
@Override
public String description() {
return "optimizedTNT must be enabled";
}
}
@Rule( desc = "Sets the tnt random explosion range to a fixed value", category = TNT, options = "-1",
validate = {CheckOptimizedTntEnabledValidator.class, TNTRandomRangeValidator.class}, extra = "Set to -1 for default behavior")
public static double tntRandomRange = -1;
private static class TNTRandomRangeValidator extends Validator<Double> {
@Override
public Double validate(ServerCommandSource source, ParsedRule<Double> currentRule, Double newValue, String string) {
return newValue == -1 || newValue >= 0 ? newValue : null;
}
@Override
public String description() {
return "Cannot be negative, except for -1";
}
}
@Rule( desc = "Sets the horizontal random angle on TNT for debugging of TNT contraptions", category = TNT, options = "-1",
validate = TNTAngleValidator.class, extra = "Set to -1 for default behavior")
public static double hardcodeTNTangle;
private static class TNTAngleValidator extends Validator<Double> {
@Override
public Double validate(ServerCommandSource source, ParsedRule<Double> currentRule, Double newValue, String string) {
return (newValue >= 0 && newValue < Math.PI * 2) || newValue == -1 ? newValue : null;
}
@Override
public String description() {
return "Must be between 0 and 2pi, or -1";
}
}
@Rule( desc = "Merges stationary primed TNT entities", category = TNT )
public static boolean mergeTNT = false;
@Rule(
desc = "Lag optimizations for redstone dust",
extra = "by Theosib",
@@ -89,6 +89,10 @@ public final class ParsedRule<T> implements Comparable<ParsedRule> {
{
return set(source, (T) (Object) Integer.parseInt(value), value);
}
else if (type == double.class)
{
return set(source, (T) (Object) Double.parseDouble(value), value);
}
else if (type.isEnum())
{
String ucValue = value.toUpperCase(Locale.ROOT);
@@ -111,6 +115,7 @@ public final class ParsedRule<T> implements Comparable<ParsedRule> {
if (value == null)
{
Messenger.m(source, "r Wrong value for " + name + ": " + stringValue);
Messenger.m(source, "r " + validator.description());
return null;
}
}
@@ -9,5 +9,6 @@ public class RuleCategory
public static final String OPTIMIZATION = "optimization";
public static final String FEATURE = "feature";
public static final String COMMAND = "command";
public static final String TNT = "tnt";
}