Skip to content

Commit

Permalink
Remove REI mixin, bump version.
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaTheDinkus committed Jul 24, 2020
1 parent c39e9d2 commit 42451d8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 73 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<ScreenHandler> containerInfo = (ContainerInfo<ScreenHandler>) ContainerInfoHandler.getContainerInfo(recipe.getRecipeCategory(), container.getClass());
RecipeProviderInfoWrapper<ArtisCraftingController> recipeProvider = (RecipeProviderInfoWrapper<ArtisCraftingController>) 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<List<EntryStack>> input = recipe.getOrganisedInputEntries(containerInfo, container);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,23 +22,17 @@
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;
import net.minecraft.screen.ScreenHandlerContext;
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;
Expand Down Expand Up @@ -204,50 +197,14 @@ public int getCraftingSlotCount() {
// update crafting
//clientside only
@Override
@Environment(EnvType.CLIENT)
public void updateSlotStacks(List<ItemStack> stacks) {
craftInv.setCheckMatrixChanges(false);
super.updateSlotStacks(stacks);
craftInv.setCheckMatrixChanges(true);
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<CraftingRecipe> opt = world.getServer().getRecipeManager().getFirstMatch(this.tableType, craftInv, world);
Optional<CraftingRecipe> 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<CraftingRecipe> 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) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mixin.artis.compat.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"compatibilityLevel": "JAVA_8",
"mixins": [],
"client": [
"DefaultCategoryHandlerMixin"

],
"injectors": {
"defaultRequire": 0
Expand Down

0 comments on commit 42451d8

Please sign in to comment.