Merge branch 'master' into 1.17

This commit is contained in:
gnembon committed 2021-05-25 17:38:11 -03:00
commit 7871727217
3 files changed
+103 -1

No files matched your search

+45
View File
@@ -52,6 +52,7 @@ public class CarpetSettings
public static boolean chainStoneStickToAll = false;
public static Block structureBlockIgnoredBlock = Blocks.STRUCTURE_VOID;
public static final int vanillaStructureBlockLimit = 48;
public static int updateSuppressionBlockSetting = -1;
private static class LanguageValidator extends Validator<String> {
@Override public String validate(ServerCommandSource source, ParsedRule<String> currentRule, String newValue, String string) {
@@ -912,4 +913,48 @@ public class CarpetSettings
category = {BUGFIX}
)
public static boolean lightningKillsDropsFix = false;
@Rule(
desc = "Placing an activator rail on top of a barrier block will update suppress when the rail turns off.",
extra = {"Entering an integer will make the update suppression block auto-reset","Integer entered is the delay in ticks for it to reset"},
category = {CREATIVE, "extras"},
options = {"false","true","1","6"},
strict = false,
validate = updateSuppressionBlockModes.class
)
public static String updateSuppressionBlock = "false";
public static int getInteger(String s) {
try {
return Integer.parseInt(s);
} catch(NumberFormatException e) {
return -1;
}
}
private static class updateSuppressionBlockModes extends Validator<String> {
@Override
public String validate(ServerCommandSource source, ParsedRule<String> currentRule, String newValue, String string) {
if (!currentRule.get().equals(newValue)) {
if (newValue.equalsIgnoreCase("false")) {
updateSuppressionBlockSetting = -1;
} else if (newValue.equalsIgnoreCase("true")) {
updateSuppressionBlockSetting = 0;
} else {
int parsedInt = getInteger(newValue);
if (parsedInt <= 0) {
updateSuppressionBlockSetting = -1;
return "false";
} else {
updateSuppressionBlockSetting = parsedInt;
}
}
}
return newValue;
}
@Override
public String description() {
return "Cannot be negative, can be true, false, or # > 0";
}
}
}