diff --git a/build.gradle b/build.gradle index 644b401..55fc1b5 100755 --- a/build.gradle +++ b/build.gradle @@ -30,7 +30,7 @@ if(rootProject.file('private.gradle').exists()) { //Publishing details archivesBaseName = "artis" group = "io.github.alloffabric" -version = "1.4.1+1.16.1" +version = "${project.mod_version}+${project.minecraft_version}" minecraft { } diff --git a/gradle.properties b/gradle.properties index 6fb1924..f16333b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ loader_version=0.9.0+build.204 fabric_version=0.15.1+build.380-1.16.1 # Mod Properties -mod_version = 1.4.1 +mod_version = 1.4.2 maven_group = io.github.alloffabric archives_base_name = artis @@ -18,6 +18,6 @@ archives_base_name = artis # libcd_version=2.5.0+1.16.1 libgui_version=2.2.0+1.16.1 static_data_version=1.1.2 -rei_version=4.10.2 +rei_version=4.10.3 nbtcrafting_version=1.16-2.0-SNAPSHOT artifice_version=0.8.1+1.16.1 \ No newline at end of file diff --git a/src/main/java/io/github/alloffabric/artis/compat/mixin/DefaultCategoryHandlerMixin.java b/src/main/java/io/github/alloffabric/artis/compat/mixin/DefaultCategoryHandlerMixin.java deleted file mode 100644 index 880d2b1..0000000 --- a/src/main/java/io/github/alloffabric/artis/compat/mixin/DefaultCategoryHandlerMixin.java +++ /dev/null @@ -1,23 +0,0 @@ -package io.github.alloffabric.artis.compat.mixin; - -import io.github.alloffabric.artis.compat.rei.ArtisDisplay; -import io.github.alloffabric.artis.inventory.ArtisCraftingController; -import me.shedaniel.rei.api.AutoTransferHandler; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(targets = "me/shedaniel/rei/plugin/autocrafting/DefaultCategoryHandler") -public class DefaultCategoryHandlerMixin { - /** - * @author Zundrel - * @reason Stop DefaultCategoryHandler from modifying the auto-crafting of Artis tables. - */ - @Inject(method = "handle(Lme/shedaniel/rei/api/AutoTransferHandler$Context;)Lme/shedaniel/rei/api/AutoTransferHandler$Result;", at = @At("HEAD"), cancellable = true) - public void handle(AutoTransferHandler.Context context, CallbackInfoReturnable callbackInfoReturnable) { - if (context.getRecipe() instanceof ArtisDisplay || context.getContainer() instanceof ArtisCraftingController) { - callbackInfoReturnable.setReturnValue(AutoTransferHandler.Result.createNotApplicable()); - } - } -} diff --git a/src/main/java/io/github/alloffabric/artis/compat/rei/ArtisCategoryHandler.java b/src/main/java/io/github/alloffabric/artis/compat/rei/ArtisCategoryHandler.java index 66ac3ed..ea7d5ba 100644 --- a/src/main/java/io/github/alloffabric/artis/compat/rei/ArtisCategoryHandler.java +++ b/src/main/java/io/github/alloffabric/artis/compat/rei/ArtisCategoryHandler.java @@ -60,15 +60,17 @@ public static boolean canUseMovePackets() { @Override public Result handle(Context context) { - if (!(context.getContainer() instanceof ArtisCraftingController) || context.getContainer() instanceof ArtisCraftingController && !(context.getRecipe() instanceof ArtisDisplay) && context.getRecipe().getRecipeCategory().equals(DefaultPlugin.CRAFTING) && !((ArtisCraftingController) context.getContainer()).getTableType().shouldIncludeNormalRecipes()) + if (!(context.getContainer() instanceof ArtisCraftingController)) return Result.createNotApplicable(); + if (context.getContainer() instanceof ArtisCraftingController && !(context.getRecipe() instanceof ArtisDisplay) && context.getRecipe().getRecipeCategory().equals(DefaultPlugin.CRAFTING) && !((ArtisCraftingController) context.getContainer()).getTableType().shouldIncludeNormalRecipes()) + return Result.createNotApplicable().blocksFurtherHandling(false); TransferRecipeDisplay recipe = (TransferRecipeDisplay) context.getRecipe(); HandledScreen containerScreen = context.getContainerScreen(); ArtisCraftingController container = (ArtisCraftingController) context.getContainer(); ContainerInfo containerInfo = (ContainerInfo) ContainerInfoHandler.getContainerInfo(recipe.getRecipeCategory(), container.getClass()); RecipeProviderInfoWrapper recipeProvider = (RecipeProviderInfoWrapper) ContainerInfoHandler.getContainerInfo(recipe.getRecipeCategory(), container.getClass()); if (containerInfo == null || context.getRecipe() instanceof ArtisDisplay && !recipeProvider.getTableType(container).getId().equals(recipe.getRecipeCategory())) - return Result.createNotApplicable(); + return Result.createNotApplicable().blocksFurtherHandling(false); if (recipe.getHeight() > containerInfo.getCraftingHeight(container) || recipe.getWidth() > containerInfo.getCraftingWidth(container)) return Result.createFailed(I18n.translate("error.rei.transfer.too_small", containerInfo.getCraftingWidth(container), containerInfo.getCraftingHeight(container))); List> input = recipe.getOrganisedInputEntries(containerInfo, container); diff --git a/src/main/java/io/github/alloffabric/artis/inventory/ArtisCraftingController.java b/src/main/java/io/github/alloffabric/artis/inventory/ArtisCraftingController.java index 74c71f9..e7659be 100644 --- a/src/main/java/io/github/alloffabric/artis/inventory/ArtisCraftingController.java +++ b/src/main/java/io/github/alloffabric/artis/inventory/ArtisCraftingController.java @@ -2,7 +2,6 @@ import io.github.alloffabric.artis.Artis; import io.github.alloffabric.artis.ArtisClient; -import io.github.alloffabric.artis.api.ArtisCraftingRecipe; import io.github.alloffabric.artis.api.ArtisTableType; import io.github.alloffabric.artis.api.ContainerLayout; import io.github.alloffabric.artis.api.RecipeProvider; @@ -23,8 +22,6 @@ import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketByteBuf; -import net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket; -import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.Recipe; import net.minecraft.recipe.RecipeFinder; import net.minecraft.recipe.RecipeType; @@ -32,14 +29,10 @@ import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.SlotActionType; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.text.LiteralText; -import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; import net.minecraft.world.World; import java.util.List; -import java.util.Optional; public class ArtisCraftingController extends SyncedGuiDescription implements RecipeProvider { private final ArtisTableType tableType; @@ -204,6 +197,7 @@ public int getCraftingSlotCount() { // update crafting //clientside only @Override + @Environment(EnvType.CLIENT) public void updateSlotStacks(List stacks) { craftInv.setCheckMatrixChanges(false); super.updateSlotStacks(stacks); @@ -211,43 +205,6 @@ public void updateSlotStacks(List stacks) { onContentChanged(null); } - //leaving here in case it's needed - public void updateResult(int syncId, World world, PlayerEntity player, CraftingInventory craftInv, CraftingResultInventory resultInv) { - if (!world.isClient) { - ServerPlayerEntity serverPlayer = (ServerPlayerEntity) player; - ItemStack stack = ItemStack.EMPTY; - Optional opt = world.getServer().getRecipeManager().getFirstMatch(this.tableType, craftInv, world); - Optional optCrafting = world.getServer().getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftInv, world); - if (opt.isPresent()) { - CraftingRecipe recipe = opt.get(); - if (resultInv.shouldCraftRecipe(world, serverPlayer, recipe)) { - stack = recipe.craft(craftInv); - } - } else if (tableType.shouldIncludeNormalRecipes() && optCrafting.isPresent()) { - CraftingRecipe recipe = optCrafting.get(); - if (resultInv.shouldCraftRecipe(world, serverPlayer, recipe)) { - stack = recipe.craft(craftInv); - } - } - - resultInv.setStack(0, stack); - serverPlayer.networkHandler.sendPacket(new ScreenHandlerSlotUpdateS2CPacket(syncId, getCraftingResultSlotIndex(), stack)); - } else { - Optional opt = world.getRecipeManager().getFirstMatch(this.tableType, craftInv, world); - if (tableType.hasCatalystSlot() && opt.isPresent()) { - CraftingRecipe recipe = opt.get(); - if (recipe instanceof ArtisCraftingRecipe) { - ArtisCraftingRecipe artisCraftingRecipe = (ArtisCraftingRecipe) recipe; - if (!artisCraftingRecipe.getCatalyst().isEmpty() && artisCraftingRecipe.getCatalystCost() > 0 && catalystCost != null) { - catalystCost.setText(new LiteralText(Formatting.RED + "-" + artisCraftingRecipe.getCatalystCost())); - } - } - } else if (tableType.hasCatalystSlot() && catalystCost != null) { - catalystCost.setText(new LiteralText("")); - } - } - } - //like vanilla, but not a pile of lag public static void updateResult(World world, PlayerEntity player, CraftingInventory inv, CraftingResultInventory result, ArtisTableType artisTableType) { if (!world.isClient) { diff --git a/src/main/resources/mixin.artis.compat.json b/src/main/resources/mixin.artis.compat.json index f1a7607..ad4ab33 100644 --- a/src/main/resources/mixin.artis.compat.json +++ b/src/main/resources/mixin.artis.compat.json @@ -5,7 +5,7 @@ "compatibilityLevel": "JAVA_8", "mixins": [], "client": [ - "DefaultCategoryHandlerMixin" + ], "injectors": { "defaultRequire": 0