mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 23:53:41 +01:00
Stability fix for backup itemstack on catched null TE errors
This commit is contained in:
parent
c81e105964
commit
f1cad974aa
1 changed files with 2 additions and 3 deletions
|
@ -39,8 +39,7 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ItemStack backup = itemstack.copy();
|
||||||
int count = itemstack.getCount();
|
|
||||||
// If none is there, try vanilla registry
|
// If none is there, try vanilla registry
|
||||||
try {
|
try {
|
||||||
Vec3d facingVec = new Vec3d(context.state.get(DispenserBlock.FACING).getDirectionVec());
|
Vec3d facingVec = new Vec3d(context.state.get(DispenserBlock.FACING).getDirectionVec());
|
||||||
|
@ -54,7 +53,7 @@ public class DispenserMovementBehaviour extends DropperMovementBehaviour {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
itemstack.setCount(count); // Something went wrong with the TE being null in ContraptionBlockSource, reset the stack
|
itemstack = backup; // Something went wrong with the TE being null in ContraptionBlockSource, reset the stack
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultBehaviour.dispense(itemstack, context, pos); // the default: launch the item
|
defaultBehaviour.dispense(itemstack, context, pos); // the default: launch the item
|
||||||
|
|
Loading…
Reference in a new issue