Conversation
…-driven # Conflicts: # src/main/java/com/cleanroommc/bogosorter/compat/DefaultCompat.java
IntelliJ IDEA seems to less stupid when handling `allOf`
|
Overengineered and will never be used by anyone. Perfect |
|
The person who opened this PR one year ago didn't realize that developers can use Bogo API via Groovy and/or CrT, so feel free to close this ¯\_(ツ)_/¯ |
|
nah, ill merge it at some point |
src/main/java/com/cleanroommc/bogosorter/compat/data_driven/DataDrivenBogoCompat.java
Show resolved
Hide resolved
src/main/java/com/cleanroommc/bogosorter/compat/data_driven/DataDrivenBogoCompat.java
Show resolved
Hide resolved
| * @author ZZZank | ||
| */ | ||
| @Desugar | ||
| record AndCond(List<BogoCondition> conditions) implements BogoCondition { |
There was a problem hiding this comment.
Not a fan of using records with jabel
There was a problem hiding this comment.
Using record saves the trouble of manually implementing all-arg constructor, getter, equals and hashcode. So if we are not switching to JVMDowngrader or Lombok, records with Jabel is by far the best solution
src/main/java/com/cleanroommc/bogosorter/compat/data_driven/handler/BogoCompatHandler.java
Outdated
Show resolved
Hide resolved
| * @author ZZZank | ||
| */ | ||
| class MappedSlotActions { | ||
| public static final Map<String, JsonSchema<Function<Slot, ISlot>>> REDUCER_REGISTRY = new LinkedHashMap<>(); |
There was a problem hiding this comment.
Why linked? This is a hash map zoo
There was a problem hiding this comment.
To keep their order when generating schemas. Not quite useful here, but for filters I want basic filters to come before compound filters (and, or, not).
src/main/java/com/cleanroommc/bogosorter/compat/data_driven/handler/MarkOnlyHandler.java
Outdated
Show resolved
Hide resolved
| definitions.put(refKey, inner); | ||
|
|
||
| var result = new JsonObject(); | ||
| result.addProperty("$ref", "#/definitions/" + refKey); |
There was a problem hiding this comment.
See: https://json-schema.org/understanding-json-schema/structuring#dollarref . Example below:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"address": { "$ref": "#/definitions/address" } // this will be linked to the 'address' below
},
"definitions": {
"address": { // here
"type": "object",
"properties": {
"street": { "type": "string" },
"city": { "type": "string" }
}
}
}
}This is equivalent to:
{
"type": "object",
"properties": {
"name": { "type": "string" },
"address": { // inlined
"type": "object",
"properties": {
"street": { "type": "string" },
"city": { "type": "string" }
}
}
}
}I use this for recursive referencing object and breaking large schema into smaller bits
| private final boolean includeOrdinal; | ||
|
|
||
| private transient final Map<String, T> named; | ||
| private transient final List<T> indexed; |
There was a problem hiding this comment.
Why do we need a list when we have the array?
There was a problem hiding this comment.
When we dont want to include enum ordinal, we want the len below to be 0:
for (int i = 0, len = indexed.size(); i < len; i++) {
enum_.add(i);
}we can do this by making the indexed an empty list. This will be harder if we use T[] indexed because we need something like new T[0]
…-driven # Conflicts: # src/main/java/com/cleanroommc/bogosorter/compat/DefaultCompat.java
This PR will allow developers and experienced users to add simple container support without touching any Java code of Bogo.
./config/bogosorter/bogo.compat.jsonin game instance folder and./bogo.compat.jsonin eveny valid mod jarironbackpackis present.not,and,orfor combining multiple conditions, and advanced mod condition like RegEx matching for mod version.Slot->ISlotmapper, blocked by Arcane archive support #82 .data-driven reflection, forming a "access sequence", the sequence must start with the container instance, and ends as an integer, ready for use in container support. Each access in this sequemce should be either getting a field, or invoking an instance method with no arg requirementdata-driven ternary operator for more flexibility