Entry Removals in json tag files#4721
Entry Removals in json tag files#4721cputnam-a11y wants to merge 158 commits intoFabricMC:1.21.9from
Conversation
fabric-tag-api-v1/src/main/java/net/fabricmc/fabric/impl/tag/FabricTagEntryImpl.java
Outdated
Show resolved
Hide resolved
fabric-tag-api-v1/src/main/java/net/fabricmc/fabric/mixin/tag/TagGroupLoaderMixin.java
Outdated
Show resolved
Hide resolved
| private boolean required; | ||
|
|
||
| @Unique | ||
| private final boolean removed; |
There was a problem hiding this comment.
Not too keen on this implementation, as is breaks assumptions that other mods may use for the TagEntry class. Instead, maybe TagFile should maintain a separate list for c:remove, in a way that is closer to the actual file representation.
There was a problem hiding this comment.
The reason it's done like this is to avoid adding a field to TagFile. We'll have to discuss alternatives. I don't really like extending TagEntry, but maybe that is preferable. I considered doing more patching to fake the field better, but decided against it for now.
There was a problem hiding this comment.
Whats the concern with adding a Field to TagFile? is it the fact its a mixin? Its not a deal breaker if we are careful.
fabric-tag-api-v1/src/main/java/net/fabricmc/fabric/mixin/tag/TagEntryMixin.java
Outdated
Show resolved
Hide resolved
modmuss50
left a comment
There was a problem hiding this comment.
I havent done an indepth review of the impl just yet. Overall I am happy with the propsoal.
I think we should start by having this as fabric:remove. As I said on discord I am hesitant to merge a c:remove without first being 100% sure that neo are also going to adopt this, we have been burnt by this before. Lets concenrate on ourselves first as we can easily add support for c:remove later when the stars have all aligned.
Data generation support is also required for this, and I think there is a lot of scope to improve the tests.
This looks like a great start though 👍
|
|
||
| import net.fabricmc.fabric.impl.tag.util.WrapperCodec; | ||
|
|
||
| public final class FabricTagEntryImpl { |
There was a problem hiding this comment.
FabricTagEntryImpl but it doesnt implement FabricTagEntry?
There was a problem hiding this comment.
I'm not sure what to call it, as it just contains the mixin context thread local and the codec we merge. It can implement FabricTagEntry, but then the mixin doesn't implement FabricTagEntryImpl, and if we make it an interface so the mixin can implement it, then we lose encapsulation
There was a problem hiding this comment.
Perhaps FabricTagEntryInternals is clearer to what it actually does?
| private boolean required; | ||
|
|
||
| @Unique | ||
| private final boolean removed; |
There was a problem hiding this comment.
Whats the concern with adding a Field to TagFile? is it the fact its a mixin? Its not a deal breaker if we are careful.
| // Test 1: Alias two non-empty tags | ||
| public static final TagKey<Item> GEMS = tagKey(RegistryKeys.ITEM, "gems"); | ||
| public static final TagKey<Item> EXPENSIVE_ROCKS = tagKey(RegistryKeys.ITEM, "expensive_rocks"); | ||
| public static final TagKey<Item> GEMS = TagTestUtils.tagKey(RegistryKeys.ITEM, "gems"); |
There was a problem hiding this comment.
Nit: Static import TagTestUtils, will make the diff a little nicer.
There was a problem hiding this comment.
Re:
Whats the concern with adding a Field to TagFile? is it the fact its a mixin? Its not a deal breaker if we are careful.
It is a record, and there currently isn't a good way to add a record field with a mixin. With current jvm behavior it wouldn't be the end of the world, but I'd prefer to avoid it if possible. I have some unpushed commits that help with this a little, I think, so I'll re request review when I push.
Git didn't give me the option to respond to the actual comment for some reason
* Fix LivingEntityFeatureRenderEvents.ALLOW_CAPE_RENDER * Make test better
…MC#4911) * Sort debug entries * Fix sorting logic * Also search by namespace
* Add refreshCommandCompletions method to fcapi * Implement requested changes * Add some comments and feedback
* Conventional armor tags * fill new tags
* Remove all @NotNull annotations * Missed one
* Start working on packet splitting * Fix checkstyle * Allow for split C2S packets, require setting max packet size (not validated on receiving end yet) * Remove old init * Finish up generic packet splitting, * Add fake passthough packet to avoid encoding splittable packets twice * Validate maxPacketSize * Source split size from CustomPayloadX2YPackets * No more magic numbers, don't send empty SplitData pacckets, some extra comments, use correct packet ids in error messages * Simplify packet splitting to single payload type, remove unnecessary metadata. * Replace finished flag with just appended packet length, add extra check for validating packet type * Correct name of genericPacketSplitter method * Fix not full rename oops * Apply player's suggestion (cherry picked from commit 57cb96d) (cherry picked from commit b095d8d)
(cherry picked from commit 19a99b0)
(cherry picked from commit 3706cdf)
(cherry picked from commit 68e881b)
* Add the Dimensions Modifications API * Fix test cloud color * Simplify dimensions modifications using events * Start the test server at noon * PR feedback * Remove logging * Switch to client game test for dimensions modifications * Remove unused logger from DimensionModificationImpl * Remove unused logger imports from DimensionModificationImpl
…abricMC#5129) * Create EventResult * Migrate EntitySleepEvents from InteractionResult to EventResult.
* Add advancement renderers * Fix import ordering * Move context classes into inner classes * Add missing renderer javadocs * Rename accessor methods * Remove accesswidener * Fix renderer registration check and exceptions * Use named locals for args
* feat: Debug API * docs(EntityDebugSubscriptionRegistry): clarify it's server-side only * chore: apply licenses * docs: `Constructor` -> `Factory` terminology on factory interfaces * fix: depend `fabricloader` `>=0.18.4` * refactor: merge `MobMixin` & `EntityMixin` * use @APinote in javadoc and use package-private Mixins Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> * refactor!: `net.fabricmc.fabric.api.debug.v1.client` -> `….api.client.debug.v1` --------- Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
* change att sync packet to only handle one attachment * add large attachments * fix gametest failure due to persistence problem * woops fix int length from testing * sync gametest logger name
* Separately flush UI elements with connected primitives * Update test * spotlessApply
* Use local variable names for all mixin locals * Add checkstyle rule + more fixes * More fixes * Renames * Cleanup * Prevent using name for args only locals --------- Co-authored-by: joe <burtonjae@hotmail.co.uk>
…faces (FabricMC#5177) * Add transitive access wideners for Enchantment functional interfaces * Revert "Add transitive access wideners for Enchantment functional interfaces" This reverts commit e7e5099. * Modify template generation instead of file directly
…abricMC#5178) * deferred sync for BEs * fix imports * avoid extra deferred sync during initial load * checkstyle * simplify sending deferred changes * spotlessApply * Avoid more unnecessary deferred syncing * add test for BE deferred sync * sync deferred removals too * avoid bundling packets if only one change
# Conflicts: # fabric-tag-api-v1/src/main/resources/fabric-tag-api-v1.mixins.json # fabric-tag-api-v1/src/testmod/java/net/fabricmc/fabric/test/tag/TagAliasTest.java
|
Hello, I will be taking over this PR for the time being. I'd like to ask about changing the JSON format for this PR a bit, I do like the simplicity of the current system, but I'd like to offer a more extensible system for any future tag related PRs, for example, ordering related fields. My main concern is that if we keep adding new fields to the root, it leaves little room for other tag PRs to add their own contents, and makes files messier. I'd also like to suggest a shortened format for remove entries if this is the case. {
// Default vanilla values.
// It is preferable to use this over 'fabric:values' for any vanilla supported entries.
// Especially when developing alongside vanilla/multiloader contexts.
"values": [
// This exact tag is why an ordering system for tags would be nice to have.
"#minecraft:tooltip_order"
],
// Any Fabric extended values.
// I feel this shouldn't be put into "values" mainly to avoid potential breakage within vanilla compatible datapacks.
// If the Conventional Tags people like this, they are free to adopt this system.
"fabric:values": [
// Removes Mending from this tag, throws if the entry was never within the tag or not removed by somebody else first.
"!minecraft:mending",
{
"id": "minecraft:mending",
"fabric:remove": true
},
// Removes othercoolmod:frost_aspect from this tag, ignored if the content was never in the tag to begin with.
{
"id": "othercoolmod:frost_aspect",
"required": false,
"fabric:remove": true
},
// Order related operations.
// No short-hand form for before/after.
{
"id": "mycoolmod:my_new_intro", //
"fabric:order": 0
},
{
"id": "mycoolmod:pharaoh_curse",
"fabric:before": [
"#minecraft:curses"
]
},
{
"id": "mycoolmod:frost_aspect",
"fabric:after": [
"minecraft:fire_aspect"
]
},
{
"id": "mycoolmod:pharaoh_curse",
"fabric:before": [
"minecraft:vanishing_curse"
],
"fabric:after": [
"othercoolmod:obabo_curse"
]
}
]
} |
|
This is probably going into mega overengineered territory, but I thought I'd suggest the full thing to see if anybody else has a better way to handle this sort of tag extension system. |
|
@cputnam-a11y Could you please change the target to 26.1 with these changes? |
|
Summary of Discord discussion with @cassiancc:
|
I don't have the dropdown to do so. googling suggested it must be done by someone with write perms to the target repo |
|
Honestly, I've done some thinking about this. I think The order stuff could be |
adds a
c:removefield to json tag files allowing removals from existing contents.{ "replace": false, "c:remove": [ "brick" ], "values": [ "brick", "snowball" ] }