Table de craft buguée
-
Enleve ça: private static final String __OBFID = “CL_00001761”; c’est pour l’obfuscation, tu n’en as pas besoin

-
J’en ai pas besoin mais il ne gêne as, j’ai carrèment la flemme de l’enlever pour être franc

-
Haha, d’accord

-
Ah, je viens de me rendre compte que c’est pas ma classe … Fuck, désolé ^^’
Voici ma classepackage eryah.usefulthings.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import eryah.usefulthings.recipes.WeaponTableRecipes; public class SlotWeaponResult extends Slot { /** The craft matrix inventory linked to this result slot. */ private final InventoryCrafting craftMatrix; /** The player that is using the GUI where this slot resides. */ private final EntityPlayer thePlayer; /** The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */ private int amountCrafted; public SlotWeaponResult(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition) { super(p_i45790_3_, slotIndex, xPosition, yPosition); this.thePlayer = player; this.craftMatrix = craftingInventory; } /** * Check if the stack is a valid item for this slot. Always true beside for the armor slots. */ public boolean isItemValid(ItemStack stack) { return false; } /** * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new * stack. */ public ItemStack decrStackSize(int amount) { if (this.getHasStack()) { this.amountCrafted += Math.min(amount, this.getStack().stackSize); } return super.decrStackSize(amount); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an * internal count then calls onCrafting(item). */ protected void onCrafting(ItemStack stack, int amount) { this.amountCrafted += amount; this.onCrafting(stack); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. */ protected void onCrafting(ItemStack stack) { if (this.amountCrafted > 0) { stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); } this.amountCrafted = 0; } public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) { net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); this.onCrafting(stack); net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); ItemStack[] aitemstack = WeaponTableRecipes.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); ItemStack itemstack2 = aitemstack*; if (itemstack1 != null) { this.craftMatrix.decrStackSize(i, 1); } if (itemstack2 != null) { if (this.craftMatrix.getStackInSlot(i) == null) { this.craftMatrix.setInventorySlotContents(i, itemstack2); } else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) { this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } } } } -
protected void onCrafting(ItemStack stack, int amount) { this.amountCrafted += amount; this.onCrafting(stack); }Tu augmentes le nombre d’items dans la case résultat sans vider la matrice de craft?
**EDIT : **Je suis con, amountCrafted c’est même pas le nombre d’items en résultat… si?
EDIT 2 :…Eryah il est con aussi, il nous donne la classe corrigée, comment il veut qu’on trouve l’erreur facepalm -
Ca pourrait être ça, mais non
-
J’ai mis la classe corrigée –’
package eryah.usefulthings.container; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import eryah.usefulthings.recipes.WeaponTableRecipes; public class SlotWeaponResult extends Slot { /** The craft matrix inventory linked to this result slot. */ private final InventoryCrafting craftMatrix; /** The player that is using the GUI where this slot resides. */ private final EntityPlayer thePlayer; /** The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */ private int amountCrafted; public SlotWeaponResult(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition) { super(p_i45790_3_, slotIndex, xPosition, yPosition); this.thePlayer = player; this.craftMatrix = craftingInventory; } /** * Check if the stack is a valid item for this slot. Always true beside for the armor slots. */ public boolean isItemValid(ItemStack stack) { return false; } /** * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new * stack. */ public ItemStack decrStackSize(int amount) { if (this.getHasStack()) { this.amountCrafted += Math.min(amount, this.getStack().stackSize); } return super.decrStackSize(amount); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an * internal count then calls onCrafting(item). */ protected void onCrafting(ItemStack stack, int amount) { this.amountCrafted += amount; this.onCrafting(stack); } /** * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. */ protected void onCrafting(ItemStack stack) { if (this.amountCrafted > 0) { stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); } this.amountCrafted = 0; } public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) { net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); this.onCrafting(stack); net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj); net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null); for (int i = 0; i < aitemstack.length; ++i) { ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); ItemStack itemstack2 = aitemstack*; if (itemstack1 != null) { this.craftMatrix.decrStackSize(i, 1); } if (itemstack2 != null) { if (this.craftMatrix.getStackInSlot(i) == null) { this.craftMatrix.setInventorySlotContents(i, itemstack2); } else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) { this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); } } } } } -
Code erroné :
ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj);Code corrigé :
ItemStack[] aitemstack = WeaponTableRecipes.getInstance().func_180303_b(this.craftMatrix, playerIn.worldObj);:::
Trouvé avec ceci x)
::: -
Je l’ai dit avant

-
Mais pas sur ce topic

-
Arghhh je venais de voir le même truc x( mais Sasukz, tu fus plus rapide…
-
Vous avez gagnés un cookie

GG a vous deux -
C’était easy avec Winmerge

