Skip to content

Commit

Permalink
fix mixin more
Browse files Browse the repository at this point in the history
  • Loading branch information
sisby-folk committed Jan 29, 2024
1 parent 6824145 commit a683e90
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ org.gradle.configureondemand=true
# Enable advanced multi-module optimizations (share tiny-remaper instance between projects)
fabric.loom.multiProjectOptimisation=true
# Mod Properties
baseVersion = 2.6.4
baseVersion = 2.6.5
defaultBranch = 1.19
branch = 1.19
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.recipe.Ingredient;
import net.minecraft.tag.ItemTags;
import net.minecraft.util.registry.Registry;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -20,11 +19,10 @@

@Mixin(Ingredient.class)
public class IngredientMixin {
@Shadow @Final public Ingredient.Entry[] entries;

@Unique private boolean isFootgun() {
if (Arrays.stream(entries).anyMatch(e -> e instanceof Ingredient.TagEntry) && Registry.ITEM.streamTagsAndEntries().toList().isEmpty()) {
TinkerersSmithing.LOGGER.error("[Tinkerer's Smithing] Cowardly refusing to access an unloaded tag ingredient: {}", this, new IllegalStateException("A tag ingredient was accessed before tags are loaded - This usually breaks recipes! Please report this to the mod in the trace below."));
Ingredient self = (Ingredient) (Object) this;
if (Arrays.stream(self.entries).anyMatch(e -> e instanceof Ingredient.TagEntry) && (Registry.ITEM.getEntryList(ItemTags.PLANKS).isEmpty() || Registry.ITEM.getEntryList(ItemTags.PLANKS).get().size() == 0)) {
TinkerersSmithing.LOGGER.error("[Tinkerer's Smithing] Cowardly refusing to access an unloaded tag ingredient: {}", self.toJson().toString(), new IllegalStateException("A tag ingredient was accessed before tags are loaded - This can break recipes! Report this to the mod in the trace below."));
return true;
}
return false;
Expand Down

0 comments on commit a683e90

Please sign in to comment.