Update updateSuppressionBlock for 1.19 (#1401)

* Changed Rule: `updateSuppressionBlock` to match new update suppression

* Make it easier to use

* Carpets mixin file will be the death of me

* Renamed `WorldInterface` to `LevelInterface`
Merged LevelAccessor with LevelInterface

* Fix issues with 22w14a & resolve issues

* Add `@Unique` to Level_tickMixin.java

* Naming, brackets, and description

* Return null on invalid

* Fix remaining refactoring issues
This commit is contained in:
Fx Morin authored and GitHub committed 2022-05-17 21:21:46 +02:00
1 parent a60bc386cb
commit 9daf72b348
11 files changed
+69 -66

No files matched your search

+12 -36
View File
@@ -54,7 +54,6 @@ 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(CommandSourceStack source, ParsedRule<String> currentRule, String newValue, String string) {
@@ -1035,57 +1034,34 @@ public class CarpetSettings
@Rule(
desc = "Lightning kills the items that drop when lightning kills an entity",
extra = {"Setting to true will prevent lightning from killing drops", "Fixes [MC-206922](https://bugs.mojang.com/browse/MC-206922)."},
category = {BUGFIX}
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"},
desc = "Placing an activator rail on top of a barrier block will fill the neighbor updater stack when the rail turns off.",
extra = {"The integer entered is the amount of updates that should be left in the stack", "-1 turns it off"},
category = CREATIVE,
options = {"-1","0","10","50"},
strict = false,
validate = updateSuppressionBlockModes.class
validate = UpdateSuppressionBlockModes.class
)
public static String updateSuppressionBlock = "false";
public static int updateSuppressionBlock = -1;
@Rule(
desc = "Fixes update suppression causing server crashes.",
category = {BUGFIX}
category = BUGFIX
)
public static boolean updateSuppressionCrashFix = false;
public static int getInteger(String s) {
try {
return Integer.parseInt(s);
} catch(NumberFormatException e) {
return -1;
}
}
private static class updateSuppressionBlockModes extends Validator<String> {
private static class UpdateSuppressionBlockModes extends Validator<Integer> {
@Override
public String validate(CommandSourceStack 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;
public Integer validate(CommandSourceStack source, ParsedRule<Integer> currentRule, Integer newValue, String string) {
return newValue < -1 ? null : newValue;
}
@Override
public String description() {
return "Cannot be negative, can be true, false, or # > 0";
return "This value represents the amount of updates required before the logger logs them. Must be -1 or larger";
}
}