Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 9452c35

Browse files
committed
Don't call getTagsFor since it's client-only
1 parent 7ad36bc commit 9452c35

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • patchwork-extensions/src/main/java/com/patchworkmc/mixin/extension

patchwork-extensions/src/main/java/com/patchworkmc/mixin/extension/MixinItem.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package com.patchworkmc.mixin.extension;
2121

22-
import java.util.Collections;
2322
import java.util.HashSet;
2423
import java.util.Map;
2524
import java.util.Set;
@@ -46,6 +45,7 @@
4645
import net.minecraft.item.ItemPropertyGetter;
4746
import net.minecraft.item.ItemStack;
4847
import net.minecraft.tag.ItemTags;
48+
import net.minecraft.tag.Tag;
4949
import net.minecraft.util.Identifier;
5050
import net.minecraft.world.RayTraceContext;
5151
import net.minecraft.world.World;
@@ -114,7 +114,14 @@ public Map<Identifier, ItemPropertyGetter> patchwork_getPropertyGetters() {
114114
@Override
115115
public Set<Identifier> getTags() {
116116
if (cachedTags == null || tagVersion != ItemTagsAccessor.getLatestVersion()) {
117-
this.cachedTags = Collections.unmodifiableSet(new HashSet<>(ItemTags.getContainer().getTagsFor(getItem())));
117+
this.cachedTags = new HashSet<>();
118+
119+
for (final Map.Entry<Identifier, Tag<Item>> entry : ItemTags.getContainer().getEntries().entrySet()) {
120+
if (entry.getValue().contains((Item) (Object) this)) {
121+
cachedTags.add(entry.getKey());
122+
}
123+
}
124+
118125
this.tagVersion = ItemTagsAccessor.getLatestVersion();
119126
}
120127

0 commit comments

Comments
 (0)