mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-11 13:04:05 +01:00
Stability fix for backup itemstack on catched null TE errors
This commit is contained in:
parent
c81e105964
commit
f1cad974aa
@ -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 New Issue
Block a user