recipe-nope/src/main/java/dev/pfaff/recipe_nope/mixin/ClientPlayNetworkHandlerMix...

23 lines
1.1 KiB
Java

package dev.pfaff.recipe_nope.mixin;
import net.minecraft.client.ClientRecipeBook;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.world.item.crafting.Recipe;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ClientPacketListener.class)
public abstract class ClientPlayNetworkHandlerMixin {
// for some reason the exact method name does not work outside of dev environment, and using wildcard causes game
// to freeze upon opening crafting table the first time (why then and not upon world join?)
//@UnconstrainedRedirect(method = "*", at = @At(value = "NEW", target = "()Lnet/minecraft/client/ClientRecipeBook;"))
//private ClientRecipeBook onGameJoin$noRecipeBook() {
// return null;
//}
@Redirect(method = "handleUpdateRecipes", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/ClientRecipeBook;setupCollections(Ljava/lang/Iterable;)V"))
private void onSynchronizeRecipes$noRecipeBook(ClientRecipeBook instance, Iterable<Recipe<?>> recipes) {
}
}