Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ dependencies {
api("com.github.GTNewHorizons:waila:1.19.22:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.8.72-GTNH:dev")

devOnlyNonPublishable("com.github.GTNewHorizons:TinkersConstruct:1.14.32-GTNH:dev")
devOnlyNonPublishable("com.github.GTNewHorizons:TinkersConstruct:1.14.86-GTNH:dev")
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ContainerBackpack extends ContainerAdventure {
private static final int CRAFT_RESULT = BUCKET_RIGHT + 2 + (MATRIX_DIMENSION * MATRIX_DIMENSION);
private static final int[] CRAFT_MATRIX_EMULATION = findCraftMatrixEmulationIDs();

private final InventoryCraftingBackpack craftMatrix = new InventoryCraftingBackpack(
protected final InventoryCraftingBackpack craftMatrix = new InventoryCraftingBackpack(
this,
MATRIX_DIMENSION,
MATRIX_DIMENSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

import tconstruct.library.modifier.IModifyable;
import tconstruct.library.tools.AbilityHelper;

public class SlotCraftResult extends SlotCrafting {

Expand All @@ -18,7 +22,40 @@ public SlotCraftResult(ContainerBackpack container, EntityPlayer player, IInvent
@Override
public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
eventHandler.syncCraftMatrixWithInventory(true); // pre craft sync
super.onPickupFromSlot(player, stack);
ItemStack tool = eventHandler.craftMatrix.getStackInSlot(4);
if (stack.getItem() instanceof IModifyable && tool != null && tool.getItem() instanceof IModifyable) {
IModifyable modifyable = (IModifyable) stack.getItem();
NBTTagCompound tags = stack.getTagCompound().getCompoundTag(modifyable.getBaseTagName());
int[] toRemoveArray = tags.hasKey("ToRemove") ? tags.getIntArray("ToRemove") : null;
int toRemoveIndex = 0;
IInventory inventory = eventHandler.craftMatrix;

for (int i = 0; i <= inventory.getSizeInventory(); i++) {
if (i == 4) continue;
ItemStack item = inventory.getStackInSlot(i);
if (item == null) {
continue;
}
if (toRemoveArray == null) {
inventory.decrStackSize(i, 1);
} else {
inventory.decrStackSize(i, toRemoveArray[toRemoveIndex]);
toRemoveIndex++;
}
}
tags.removeTag("ToRemove");

inventory.setInventorySlotContents(4, null);
player.worldObj.playSoundEffect(
player.posX,
player.posY,
player.posZ,
"tinker:little_saw",
1.0F,
(AbilityHelper.random.nextFloat() - AbilityHelper.random.nextFloat()) * 0.2F + 1.0F);
} else {
super.onPickupFromSlot(player, stack);
}
eventHandler.syncCraftMatrixWithInventory(false); // post craft sync
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.util.ResourceLocation;

Expand All @@ -25,7 +26,7 @@ public static void updateTabValues(int cornerX, int cornerY, Class<?> selectedBu
}

public static void addTabsToList(List<?> buttonList) {
TabRegistry.addTabsToList(buttonList);
TabRegistry.addTabsToList((List<GuiButton>) buttonList);
}

public static class Tab extends AbstractTab {
Expand Down