-
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.
- Loading branch information
1 parent
6f63e9d
commit b7e7f79
Showing
50 changed files
with
574 additions
and
589 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
7 changes: 7 additions & 0 deletions
7
src/main/java/com/mmodding/env/json/api/RelativeLocation.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.mmodding.env.json.api; | ||
|
||
public enum RelativeLocation { | ||
BELOW, | ||
AT, | ||
ABOVE | ||
} |
8 changes: 0 additions & 8 deletions
8
src/main/java/com/mmodding/env/json/api/rule/AnyEnvJsonRule.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/java/com/mmodding/env/json/api/rule/DimensionEnvJsonRule.java
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
25 changes: 25 additions & 0 deletions
25
src/main/java/com/mmodding/env/json/api/rule/EnvJsonRules.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.mmodding.env.json.api.rule; | ||
|
||
import com.google.gson.JsonElement; | ||
import com.mmodding.env.json.api.rule.parsing.EnvJsonRuleParser; | ||
import com.mmodding.env.json.impl.rule.EnvJsonRulesImpl; | ||
import net.minecraft.util.Identifier; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
@ApiStatus.NonExtendable | ||
public final class EnvJsonRules { | ||
|
||
public EnvJsonRules() { | ||
throw new IllegalStateException("EnvJsonRules class only contains static definitions"); | ||
} | ||
|
||
/** | ||
* Allows to register a new {@link EnvJsonRuleParser} under an identifier | ||
* @param identifier the identifier | ||
* @param parser the parser | ||
* @param <E> the class of the shape of the json element the parser should parse | ||
*/ | ||
public static <E extends JsonElement> void register(Identifier identifier, EnvJsonRuleParser<E, ? extends EnvJsonRule> parser) { | ||
EnvJsonRulesImpl.REGISTRY.put(identifier, parser); | ||
} | ||
} |
6 changes: 0 additions & 6 deletions
6
src/main/java/com/mmodding/env/json/api/rule/NotEnvJsonRule.java
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
src/main/java/com/mmodding/env/json/api/rule/SequenceEnvJsonRule.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/main/java/com/mmodding/env/json/api/rule/SkyEnvJsonRule.java
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/java/com/mmodding/env/json/api/rule/SubmergedEnvJsonRule.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/main/java/com/mmodding/env/json/api/rule/VoidEnvJsonRule.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
src/main/java/com/mmodding/env/json/api/rule/WaterEnvJsonRule.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
src/main/java/com/mmodding/env/json/api/rule/builtin/AnyEnvJsonRule.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.mmodding.env.json.api.rule.builtin; | ||
|
||
import com.mmodding.env.json.api.rule.EnvJsonRule; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Represents a sequence of combined rules with the OR operator. | ||
*/ | ||
@ApiStatus.NonExtendable | ||
public interface AnyEnvJsonRule extends EnvJsonRule { | ||
|
||
List<EnvJsonRule> rules(); | ||
} |
8 changes: 7 additions & 1 deletion
8
...g/env/json/api/rule/BiomeEnvJsonRule.java → ...on/api/rule/builtin/BiomeEnvJsonRule.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
10 changes: 8 additions & 2 deletions
10
...g/env/json/api/rule/CoordEnvJsonRule.java → ...on/api/rule/builtin/CoordEnvJsonRule.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
24 changes: 24 additions & 0 deletions
24
src/main/java/com/mmodding/env/json/api/rule/builtin/DimensionEnvJsonRule.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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.mmodding.env.json.api.rule.builtin; | ||
|
||
import com.mmodding.env.json.api.rule.EnvJsonRule; | ||
import net.minecraft.registry.RegistryKey; | ||
import net.minecraft.registry.tag.TagKey; | ||
import net.minecraft.world.World; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
/** | ||
* Represents a dimension rule where the object should be. | ||
*/ | ||
@ApiStatus.NonExtendable | ||
public interface DimensionEnvJsonRule extends EnvJsonRule { | ||
|
||
/** | ||
* If this method returns null, then {@link DimensionEnvJsonRule#tag()} must return a nonnull value. | ||
*/ | ||
RegistryKey<World> dimension(); | ||
|
||
/** | ||
* If this method returns null, then {@link DimensionEnvJsonRule#dimension()} must return a nonnull value. | ||
*/ | ||
TagKey<World> tag(); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/mmodding/env/json/api/rule/builtin/NotEnvJsonRule.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.mmodding.env.json.api.rule.builtin; | ||
|
||
import com.mmodding.env.json.api.rule.EnvJsonRule; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
/** | ||
* Reverses the rule. | ||
*/ | ||
@ApiStatus.NonExtendable | ||
public interface NotEnvJsonRule extends EnvJsonRule { | ||
|
||
EnvJsonRule rule(); | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/mmodding/env/json/api/rule/builtin/SequenceEnvJsonRule.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.mmodding.env.json.api.rule.builtin; | ||
|
||
import com.mmodding.env.json.api.rule.EnvJsonRule; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Represents a sequence of combined rules with the AND operator. | ||
*/ | ||
@ApiStatus.NonExtendable | ||
public interface SequenceEnvJsonRule extends EnvJsonRule { | ||
|
||
List<EnvJsonRule> rules(); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/mmodding/env/json/api/rule/builtin/SkyEnvJsonRule.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.mmodding.env.json.api.rule.builtin; | ||
|
||
import com.mmodding.env.json.api.RelativeLocation; | ||
import com.mmodding.env.json.api.rule.EnvJsonRule; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
/** | ||
* Represents a rule checking if the object is below or above the sky limit. | ||
*/ | ||
@ApiStatus.NonExtendable | ||
public interface SkyEnvJsonRule extends EnvJsonRule { | ||
|
||
RelativeLocation location(); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/mmodding/env/json/api/rule/builtin/SubmergedEnvJsonRule.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.mmodding.env.json.api.rule.builtin; | ||
|
||
import com.mmodding.env.json.api.rule.EnvJsonRule; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
/** | ||
* Represents a rule checking if the object is surrounded by water. | ||
*/ | ||
@ApiStatus.NonExtendable | ||
public interface SubmergedEnvJsonRule extends EnvJsonRule { | ||
|
||
boolean submerged(); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/mmodding/env/json/api/rule/builtin/VoidEnvJsonRule.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.mmodding.env.json.api.rule.builtin; | ||
|
||
import com.mmodding.env.json.api.RelativeLocation; | ||
import com.mmodding.env.json.api.rule.EnvJsonRule; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
/** | ||
* Represents a rule checking if the object is below or above the void limit. | ||
*/ | ||
@ApiStatus.NonExtendable | ||
public interface VoidEnvJsonRule extends EnvJsonRule { | ||
|
||
RelativeLocation location(); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/mmodding/env/json/api/rule/builtin/WaterEnvJsonRule.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.mmodding.env.json.api.rule.builtin; | ||
|
||
import com.mmodding.env.json.api.RelativeLocation; | ||
import com.mmodding.env.json.api.rule.EnvJsonRule; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
/** | ||
* Represents a rule checking if the object is below or above the water level. | ||
*/ | ||
@ApiStatus.NonExtendable | ||
public interface WaterEnvJsonRule extends EnvJsonRule { | ||
|
||
RelativeLocation location(); | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/com/mmodding/env/json/api/rule/parsing/EnvJsonRuleParser.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.mmodding.env.json.api.rule.parsing; | ||
|
||
import com.google.gson.JsonElement; | ||
import com.mmodding.env.json.api.rule.EnvJsonRule; | ||
|
||
@FunctionalInterface | ||
public interface EnvJsonRuleParser<E extends JsonElement, R extends EnvJsonRule> { | ||
|
||
R parse(E element, ParserCallback callback); | ||
} |
Oops, something went wrong.