diff --git a/build.gradle b/build.gradle index 48a390a5..93789b87 100644 --- a/build.gradle +++ b/build.gradle @@ -184,7 +184,7 @@ dependencies { api("org.sinytra:forgified-fabric-loader:2.5.29+0.16.0+1.21") include modApi("org.sinytra.forgified-fabric-api:fabric-api-base:0.4.42+d1308dedd1") { exclude group: "fabric-api" } - include modApi("org.sinytra.forgified-fabric-api:fabric-networking-api-v1:4.2.2+c9adfcd719") { exclude group: "fabric-api" } + include modApi("org.sinytra.forgified-fabric-api:fabric-networking-api-v1:4.2.2+a92978fd19") { exclude group: "fabric-api" } include modApi("org.sinytra.forgified-fabric-api:fabric-screen-api-v1:2.0.24+79a4c2b0d1") { exclude group: "fabric-api" } testmodImplementation sourceSets.main.output diff --git a/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemMixin.java b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemMixin.java index 86cdb7b5..4874888f 100644 --- a/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemMixin.java +++ b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemMixin.java @@ -17,7 +17,7 @@ @Mixin(Item.class) public class ItemMixin implements OwoItemExtensions { - protected Supplier<@Nullable ? extends ItemGroup> owo$group = () -> null; + protected @Nullable Supplier<@Nullable ? extends ItemGroup> owo$group = () -> null; @Unique private int owo$tab = 0; @@ -53,7 +53,7 @@ private void grabTab(Item.Settings settings, CallbackInfo ci) { @Override public @Nullable ItemGroup owo$group() { - return this.owo$group.get(); + return this.owo$group != null ? this.owo$group.get() : null; } @Override diff --git a/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java index f6284242..f65562d3 100644 --- a/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java +++ b/src/main/java/io/wispforest/owo/mixin/itemgroup/ItemSettingsMixin.java @@ -41,7 +41,7 @@ public Item.Settings group(Supplier groupSupplier) { @Override public OwoItemGroup group() { - return owo$group.get(); + return owo$group != null ? owo$group.get() : null; } @Override diff --git a/src/main/java/io/wispforest/owo/mixin/recipe_remainders/RecipeManagerMixin.java b/src/main/java/io/wispforest/owo/mixin/recipe_remainders/RecipeManagerMixin.java index 1298fd98..d3aa6dae 100644 --- a/src/main/java/io/wispforest/owo/mixin/recipe_remainders/RecipeManagerMixin.java +++ b/src/main/java/io/wispforest/owo/mixin/recipe_remainders/RecipeManagerMixin.java @@ -19,6 +19,8 @@ import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.profiler.Profiler; import net.minecraft.world.World; +import net.neoforged.neoforge.common.conditions.WithConditions; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -33,8 +35,12 @@ @Mixin(RecipeManager.class) public abstract class RecipeManagerMixin { - @Inject(method = "apply(Ljava/util/Map;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/RecipeEntry;(Lnet/minecraft/util/Identifier;Lnet/minecraft/recipe/Recipe;)V")) - private void deserializeRecipeSpecificRemainders(Map map, ResourceManager resourceManager, Profiler profiler, CallbackInfo ci, @Local Map.Entry entry) { + public final ThreadLocal> previousMapEntry = ThreadLocal.withInitial(() -> null); + + @Inject(method = "apply(Ljava/util/Map;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)V", at = @At(value = "INVOKE", target = "Ljava/util/Optional;ifPresentOrElse(Ljava/util/function/Consumer;Ljava/lang/Runnable;)V")) + private void deserializeRecipeSpecificRemainders(Map map, ResourceManager resourceManager, Profiler profiler, CallbackInfo ci, @Local Map.Entry entry, @Local Optional>> decoded) { + if(decoded.isEmpty()) return; + var json = entry.getValue().getAsJsonObject(); if (!json.has("owo:remainders")) return; diff --git a/src/main/java/io/wispforest/owo/network/OwoHandshake.java b/src/main/java/io/wispforest/owo/network/OwoHandshake.java index 4b66e765..3d814199 100644 --- a/src/main/java/io/wispforest/owo/network/OwoHandshake.java +++ b/src/main/java/io/wispforest/owo/network/OwoHandshake.java @@ -31,6 +31,7 @@ import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.fml.loading.FMLLoader; import org.jetbrains.annotations.ApiStatus; +import org.sinytra.fabric.networking_api.client.NeoClientConfigurationNetworking; import java.util.HashMap; import java.util.HashSet; @@ -161,7 +162,8 @@ private static void syncServer(HandshakeResponse response, ServerConfigurationNe @OnlyIn(Dist.CLIENT) private static void handleReadyClient(ClientConfigurationNetworkHandler handler, MinecraftClient client) { - if (ClientConfigurationNetworking.canSend(CHANNEL_ID) || !HANDSHAKE_REQUIRED || !ENABLED) return; + // TODO: Report issues with ClientConfigurationNetworking.canSend(CHANNEL_ID) + if (NeoClientConfigurationNetworking.canSend(CHANNEL_ID) || !HANDSHAKE_REQUIRED || !ENABLED) return; client.execute(() -> { ((ClientCommonNetworkHandlerAccessor) handler) diff --git a/src/main/java/io/wispforest/owo/shader/GlProgram.java b/src/main/java/io/wispforest/owo/shader/GlProgram.java index ef690e90..467cfbd9 100644 --- a/src/main/java/io/wispforest/owo/shader/GlProgram.java +++ b/src/main/java/io/wispforest/owo/shader/GlProgram.java @@ -46,7 +46,7 @@ public GlProgram(Identifier id, VertexFormat vertexFormat) { REGISTERED_PROGRAMS.add(new Pair<>( resourceFactory -> { try { - return new OwoShaderProgram(resourceFactory, id.toString(), vertexFormat); + return new OwoShaderProgram(resourceFactory, id, vertexFormat); } catch (IOException e) { throw new RuntimeException("Failed to initialized owo shader program", e); } @@ -89,8 +89,8 @@ public static void forEachProgram(Consumer - \ No newline at end of file