Skip to content

Commit

Permalink
Merge branch 'tags_api' of github.com:LambdAurora/quilt-standard-libr…
Browse files Browse the repository at this point in the history
…aries into tags_api
  • Loading branch information
LambdAurora committed Oct 11, 2021
2 parents a486484 + abdb0d4 commit d4478b9
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@

@ApiStatus.Internal
public interface QuiltRequiredTagListHooks<T> {
Tag.Identified<T> qsl$addTag(Identifier id, TagType type);
Tag.Identified<T> quilt$addTag(Identifier id, TagType type);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@

@ApiStatus.Internal
public interface QuiltRequiredTagWrapperHooks {
void qsl$setTagType(TagType tagType);
void quilt$setTagType(TagType tagType);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

@ApiStatus.Internal
public interface QuiltTagHooks {
void qsl$setClearCount(int clearCount);
void quilt$setClearCount(int clearCount);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
*/
@ApiStatus.Internal
public interface QuiltTagManagerHooks {
void qsl$putTagGroup(RegistryKey<? extends Registry<?>> registryKey, TagGroup<?> tagGroup);
void quilt$putTagGroup(RegistryKey<? extends Registry<?>> registryKey, TagGroup<?> tagGroup);
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected Tag<T> getTag() {
}

@Override
public void qsl$setClearCount(int clearCount) {
public void quilt$setClearCount(int clearCount) {
this.clearCount = clearCount;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public Tag.Identified<T> create(Identifier id, TagType type) {
for (var requiredTagList : RequiredTagListRegistryAccessor.getAll()) {
if (requiredTagList.getRegistryKey() == this.registryKey) {
//noinspection unchecked
yield ((QuiltRequiredTagListHooks<T>) requiredTagList).qsl$addTag(id, type);
yield ((QuiltRequiredTagListHooks<T>) requiredTagList).quilt$addTag(id, type);
}
}

Expand Down Expand Up @@ -142,7 +142,7 @@ public static void loadDynamicRegistryTags(DynamicRegistryManager registryManage

var tagGroupLoader = new TagGroupLoader<>(registry::getOrEmpty, tagList.getDataType());
TagGroup<?> tagGroup = tagGroupLoader.load(resourceManager);
((QuiltTagManagerHooks) ServerTagManagerHolder.getTagManager()).qsl$putTagGroup(registryKey, tagGroup);
((QuiltTagManagerHooks) ServerTagManagerHolder.getTagManager()).quilt$putTagGroup(registryKey, tagGroup);
tagList.updateTagManager(ServerTagManagerHolder.getTagManager());
loadedTags += tagGroup.getTags().size();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ private TagGroup<T> buildDynamicGroup(Map<Identifier, Tag.Builder> tagBuilders)
Multimap<Identifier, Identifier> tagEntries = HashMultimap.create();

tagBuilders.forEach((tagId, builder) -> builder.forEachTagId(
tagEntryId -> TagGroupLoaderAccessor.qsl$addDependencyIfNotCyclic(tagEntries, tagId, tagEntryId)
tagEntryId -> TagGroupLoaderAccessor.quilt$addDependencyIfNotCyclic(tagEntries, tagId, tagEntryId)
));
tagBuilders.forEach((tagId, builder) -> builder.forEachGroupId(
entryId -> TagGroupLoaderAccessor.qsl$addDependencyIfNotCyclic(tagEntries, tagId, entryId)
entryId -> TagGroupLoaderAccessor.quilt$addDependencyIfNotCyclic(tagEntries, tagId, entryId)
));

var set = new HashSet<Identifier>();
tagBuilders.keySet().forEach(tagId ->
TagGroupLoaderAccessor.qsl$visitDependenciesAndElement(tagBuilders, tagEntries, set, tagId,
TagGroupLoaderAccessor.quilt$visitDependenciesAndElement(tagBuilders, tagEntries, set, tagId,
(currentTagId, builder) -> tags.put(tagId, this.buildLenientTag(builder, tagGetter, registryGetter))
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public class RequiredTagListMixin<T> implements QuiltRequiredTagListHooks<T> {
private List<RequiredTagList.TagWrapper<T>> tags;

@Override
public Tag.Identified<T> qsl$addTag(Identifier id, TagType type) {
public Tag.Identified<T> quilt$addTag(Identifier id, TagType type) {
var wrapper = new RequiredTagList.TagWrapper<T>(id);
//noinspection ConstantConditions
((QuiltRequiredTagWrapperHooks) wrapper).qsl$setTagType(type);
((QuiltRequiredTagWrapperHooks) wrapper).quilt$setTagType(type);
this.tags.add(wrapper);
return wrapper;
}
Expand All @@ -69,7 +69,7 @@ public TagType getType() {
}

@Override
public void qsl$setTagType(TagType tagType) {
public void quilt$setTagType(TagType tagType) {
this.tagType = tagType;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class TagBuilderMixin implements QuiltTagBuilder {
private List<Tag.TrackedEntry> entries;

@Unique
private int qsl$clearCount;
private int quilt$clearCount;

@Redirect(
method = "build",
Expand All @@ -53,18 +53,18 @@ public class TagBuilderMixin implements QuiltTagBuilder {
)
)
private Either<Collection<Tag.TrackedEntry>, Object> build(Object tag) {
((QuiltTagHooks) tag).qsl$setClearCount(this.qsl$clearCount);
((QuiltTagHooks) tag).quilt$setClearCount(this.quilt$clearCount);
return Either.right(tag);
}

@Inject(method = "read", at = @At(value = "INVOKE", target = "Ljava/util/List;clear()V"))
public void onFromJsonClear(JsonObject json, String packName, CallbackInfoReturnable<Tag.Builder> info) {
this.qsl$clearCount++;
this.quilt$clearCount++;
}

@Override
public void clearEntries() {
this.entries.clear();
this.qsl$clearCount++;
this.quilt$clearCount++;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
@Mixin(value = {RequiredTagList.TagWrapper.class, SetTag.class})
public abstract class TagImplMixin<T> implements QuiltTag<T>, QuiltTagHooks, Tag<T> {
@Unique
private int qsl$clearCount;
private int quilt$clearCount;

@Override
public boolean hasBeenReplaced() {
return this.qsl$clearCount > 0;
return this.quilt$clearCount > 0;
}

@Override
public void qsl$setClearCount(int clearCount) {
this.qsl$clearCount = clearCount;
public void quilt$setClearCount(int clearCount) {
this.quilt$clearCount = clearCount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private void init(Map<RegistryKey<? extends Registry<?>>, TagGroup<?>> tagGroups
}

@Override
public void qsl$putTagGroup(RegistryKey<? extends Registry<?>> registryKey, TagGroup<?> tagGroup) {
public void quilt$putTagGroup(RegistryKey<? extends Registry<?>> registryKey, TagGroup<?> tagGroup) {
this.tagGroups.put(registryKey, tagGroup);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
@Mixin(TagGroupLoader.class)
public interface TagGroupLoaderAccessor {
@Invoker("method_32839")
static void qsl$visitDependenciesAndElement(Map<Identifier, Tag.Builder> map,
static void quilt$visitDependenciesAndElement(Map<Identifier, Tag.Builder> map,
Multimap<Identifier, Identifier> tagEntries, Set<Identifier> set,
Identifier identifier, BiConsumer<Identifier, Tag.Builder> consumer) {
throw new IllegalStateException("Invoker injection failed.");
}

@Invoker("method_32844")
static void qsl$addDependencyIfNotCyclic(Multimap<Identifier, Identifier> tagEntries, Identifier tagId, Identifier entryId) {
static void quilt$addDependencyIfNotCyclic(Multimap<Identifier, Identifier> tagEntries, Identifier tagId, Identifier entryId) {
throw new IllegalStateException("Invoker injection failed.");
}
}

0 comments on commit d4478b9

Please sign in to comment.