-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from Gilly7CE/mcversion-1.18.2
Update minecraft version to 1.18.2
- Loading branch information
Showing
11 changed files
with
72 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 41 additions & 19 deletions
60
src/main/java/gillycarpetaddons/GillyCarpetAddonsSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 18 additions & 24 deletions
42
src/main/java/gillycarpetaddons/ruleobservers/movableSpawnerRuleObserver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,31 @@ | ||
package gillycarpetaddons.ruleobservers; | ||
|
||
import carpet.CarpetSettings; | ||
import carpet.api.settings.CarpetRule; | ||
import carpet.api.settings.InvalidRuleValueException; | ||
import carpet.api.settings.SettingsManager; | ||
import carpet.settings.ParsedRule; | ||
import net.minecraft.server.command.ServerCommandSource; | ||
import net.minecraft.text.Text; | ||
import org.apache.logging.log4j.util.TriConsumer; | ||
|
||
import java.util.Objects; | ||
|
||
public final class movableSpawnerRuleObserver implements SettingsManager.RuleObserver { | ||
public final class movableSpawnerRuleObserver implements TriConsumer<ServerCommandSource, ParsedRule<?>, String> { | ||
@Override | ||
public void ruleChanged(ServerCommandSource source, CarpetRule<?> changedRule, String userInput) { | ||
try { | ||
// Using a string here directly feels wrong but likelihood of renaming this rule is low | ||
if (!Objects.equals(changedRule.name(), "movableSpawners")) { | ||
return; | ||
} | ||
|
||
boolean ruleEnabled = (boolean) changedRule.value(); | ||
if (!ruleEnabled) { | ||
return; | ||
} | ||
|
||
if (CarpetSettings.movableBlockEntities) { | ||
return; | ||
} | ||
public void accept(ServerCommandSource source, ParsedRule<?> rule, String userTypedValue) { | ||
// Using a string here directly feels wrong but likelihood of renaming this rule is low | ||
if (!Objects.equals(rule.name, "movableSpawners")) { | ||
return; | ||
} | ||
|
||
source.sendError(Text.of("The carpet rule 'movableBlockEntities' must be enabled to use this rule!")); | ||
changedRule.set(source, String.valueOf(false)); | ||
boolean ruleEnabled = rule.getBoolValue(); | ||
if (!ruleEnabled) { | ||
return; | ||
} | ||
catch (InvalidRuleValueException e) { | ||
e.notifySource(changedRule.name(), source); | ||
|
||
if (CarpetSettings.movableBlockEntities) { | ||
return; | ||
} | ||
|
||
source.sendError(Text.of("The carpet rule 'movableBlockEntities' must be enabled to use this rule!")); | ||
rule.set(source, String.valueOf(false)); | ||
} | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
src/main/resources/assets/gilly7ce-carpet-addons/lang/en_us.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters