mirror of
https://github.com/AlmostReliable/almostunified.git
synced 2024-11-14 19:25:13 -05:00
fix tag ownership crash on dedicated servers
This commit is contained in:
parent
84d5a94630
commit
949182f13e
2 changed files with 10 additions and 2 deletions
|
@ -7,6 +7,7 @@ import com.almostreliable.unified.utils.ReplacementMap;
|
|||
import com.almostreliable.unified.utils.TagMap;
|
||||
import com.almostreliable.unified.utils.TagOwnerships;
|
||||
import com.almostreliable.unified.utils.UnifyTag;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.gson.JsonElement;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -84,4 +85,9 @@ public class AlmostUnifiedFallbackRuntime implements AlmostUnifiedRuntime {
|
|||
public Optional<UnifyConfig> getUnifyConfig() {
|
||||
return Optional.ofNullable(config);
|
||||
}
|
||||
|
||||
public TagOwnerships getTagOwnerships() {
|
||||
Preconditions.checkNotNull(tagOwnerships, "TagOwnerships were not loaded correctly");
|
||||
return tagOwnerships;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.almostreliable.unified.compat;
|
||||
|
||||
import com.almostreliable.unified.AlmostUnified;
|
||||
import com.almostreliable.unified.AlmostUnifiedFallbackRuntime;
|
||||
import com.almostreliable.unified.AlmostUnifiedRuntime;
|
||||
import com.almostreliable.unified.utils.ReplacementMap;
|
||||
import com.almostreliable.unified.utils.TagMap;
|
||||
|
@ -91,8 +92,9 @@ public class HideHelper {
|
|||
private static Set<ResourceLocation> getRefItems(ReplacementMap repMap) {
|
||||
Set<ResourceLocation> hidingList = new HashSet<>();
|
||||
|
||||
for (var ref : AlmostUnified.getTagOwnerships().getRefs()) {
|
||||
var owner = AlmostUnified.getTagOwnerships().getOwnerByTag(ref);
|
||||
var tagOwnerships = AlmostUnifiedFallbackRuntime.getInstance().getTagOwnerships();
|
||||
for (var ref : tagOwnerships.getRefs()) {
|
||||
var owner = tagOwnerships.getOwnerByTag(ref);
|
||||
assert owner != null;
|
||||
|
||||
var dominantItem = repMap.getPreferredItemForTag(owner, $ -> true);
|
||||
|
|
Loading…
Reference in a new issue