Fixed an issue with repairs taking items not related with the repaired one

master
Wynd 2024-08-07 23:23:09 +03:00
parent 32b1194eec
commit 141217b365
2 changed files with 11 additions and 4 deletions

View File

@ -9,7 +9,7 @@ import java.util.HashMap;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.Player;
import net.minecraft.item.ItemInstance;
import net.minecraft.tile.Tile;
import net.minecraft.item.ItemType;
public class WyHelper {
@ -90,8 +90,10 @@ public class WyHelper {
}
public static void cheatCommand(Player player) {
player.dropItem(new ItemInstance(Tile.LADDER, 64));
player.dropItem(new ItemInstance(Tile.WOOD, 64));
player.dropItem(new ItemInstance(ItemType.pickaxeIron, 1, 100));
player.dropItem(new ItemInstance(ItemType.pickaxeIron, 1, 150));
player.dropItem(new ItemInstance(ItemType.pickaxeDiamond, 1, 150));
// player.dropItem(new ItemInstance(Tile.WOOD, 64));
// player.dropItem(new ItemInstance(ItemType.snowball, 60));
player.level.setLevelTime(0);

View File

@ -27,6 +27,11 @@ public class CraftingContainerMixin {
for (int i = 0; i < inventory.getInvSize(); i++) {
ItemInstance item = inventory.getInvItem(i);
if ((item != null && item.method_723() <= 0) || (item != null && resultItem != null && item.itemId != resultItem.itemId)) {
resultItem = null;
break;
}
if (item != null && item.method_723() > 0) {
if (resultItem == null) {
resultItem = new ItemInstance(item.itemId, 1, item.getDamage());