Skip to content

Commit

Permalink
Fix FallingColors#467, config-disabled patterns no longer spawned as …
Browse files Browse the repository at this point in the history
…loot (this is a "should fix it" not a "confirmed fixed it")
  • Loading branch information
Talia-12 committed Feb 6, 2024
1 parent b29ab76 commit 7ace8b1
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package at.petrak.hexcasting.common.loot;

import at.petrak.hexcasting.api.HexAPI;
import at.petrak.hexcasting.api.casting.ActionRegistryEntry;
import at.petrak.hexcasting.api.mod.HexConfig;
import at.petrak.hexcasting.api.mod.HexTags;
import at.petrak.hexcasting.api.utils.HexUtils;
import at.petrak.hexcasting.common.casting.PatternRegistryManifest;
Expand Down Expand Up @@ -40,7 +42,7 @@ public static ItemStack doStatic(ItemStack stack, LootContext ctx) {
var perWorldKeys = new ArrayList<ResourceKey<ActionRegistryEntry>>();
Registry<ActionRegistryEntry> regi = IXplatAbstractions.INSTANCE.getActionRegistry();
for (var key : regi.registryKeySet()) {
if (HexUtils.isOfTag(regi, key, HexTags.Actions.PER_WORLD_PATTERN)) {
if (HexUtils.isOfTag(regi, key, HexTags.Actions.PER_WORLD_PATTERN) && HexConfig.server().isActionAllowed(key.location())) {
perWorldKeys.add(key);
}
}
Expand All @@ -49,7 +51,11 @@ public static ItemStack doStatic(ItemStack stack, LootContext ctx) {
var pat = PatternRegistryManifest.getCanonicalStrokesPerWorld(key, ctx.getLevel().getServer().overworld());
var tag = new CompoundTag();
tag.putString(ItemScroll.TAG_OP_ID, key.location().toString());
tag.put(ItemScroll.TAG_PATTERN, pat.serializeToNBT());
if (pat != null) {
tag.put(ItemScroll.TAG_PATTERN, pat.serializeToNBT());
} else {
HexAPI.LOGGER.warn("Tried to generate great scroll for %s, doesn't have canonical per-world strokes.".formatted(key));
}

stack.getOrCreateTag().merge(tag);

Expand Down

0 comments on commit 7ace8b1

Please sign in to comment.