Fixed pattern stack copying
This commit is contained in:
@@ -14,7 +14,7 @@ public interface ICraftingPatternProvider {
|
|||||||
* Creates a crafting pattern.
|
* Creates a crafting pattern.
|
||||||
*
|
*
|
||||||
* @param world the world
|
* @param world the world
|
||||||
* @param stack the pattern stack
|
* @param stack the pattern stack, the implementor needs to copy it
|
||||||
* @param container the {@link ICraftingPatternContainer} where the pattern is in
|
* @param container the {@link ICraftingPatternContainer} where the pattern is in
|
||||||
* @return the crafting pattern
|
* @return the crafting pattern
|
||||||
*/
|
*/
|
||||||
|
@@ -63,8 +63,7 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
|
|||||||
ItemStack patternStack = patterns.getStackInSlot(i);
|
ItemStack patternStack = patterns.getStackInSlot(i);
|
||||||
|
|
||||||
if (!patternStack.isEmpty()) {
|
if (!patternStack.isEmpty()) {
|
||||||
// We copy the pattern stack because if we remove it from the inventory, the crafting task will use a pattern with an invalid stack...
|
ICraftingPattern pattern = ((ICraftingPatternProvider) patternStack.getItem()).create(world, patternStack, this);
|
||||||
ICraftingPattern pattern = ((ICraftingPatternProvider) patternStack.getItem()).create(world, patternStack.copy(), this);
|
|
||||||
|
|
||||||
if (pattern.isValid()) {
|
if (pattern.isValid()) {
|
||||||
actualPatterns.add(pattern);
|
actualPatterns.add(pattern);
|
||||||
|
@@ -202,6 +202,7 @@ public class ItemPattern extends ItemBase implements ICraftingPatternProvider {
|
|||||||
@Override
|
@Override
|
||||||
@Nonnull
|
@Nonnull
|
||||||
public ICraftingPattern create(World world, ItemStack stack, ICraftingPatternContainer container) {
|
public ICraftingPattern create(World world, ItemStack stack, ICraftingPatternContainer container) {
|
||||||
return new CraftingPattern(world, container, stack);
|
// We copy the pattern stack because if we remove it from the inventory, the crafting task will use a pattern with an invalid stack...
|
||||||
|
return new CraftingPattern(world, container, stack.copy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user