Merge pull request #3589 from Darkere/fix/GH-3514/fix-rare-autocrafting-crash
fix: rare autocrafting crash
This commit is contained in:
@@ -9,7 +9,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed JEI transfer for larger processing recipes
|
- Fixed JEI transfer for larger processing recipes
|
||||||
|
- Fixed rare autocrafting crash
|
||||||
|
|
||||||
## [1.12.3] - 2023-07-07
|
## [1.12.3] - 2023-07-07
|
||||||
|
|
||||||
|
@@ -47,8 +47,20 @@ public class CraftingNode extends Node {
|
|||||||
|
|
||||||
if (interval == 0 || ticks % interval == 0) {
|
if (interval == 0 || ticks % interval == 0) {
|
||||||
for (int i = 0; i < container.getMaximumSuccessfulCraftingUpdates(); i++) {
|
for (int i = 0; i < container.getMaximumSuccessfulCraftingUpdates(); i++) {
|
||||||
if (IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(true), internalStorage, Action.SIMULATE) != null) {
|
|
||||||
IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(false), internalStorage, Action.PERFORM);
|
var simulatedRequirements = requirements.getSingleItemRequirementSet(true);
|
||||||
|
if(simulatedRequirements == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IoUtil.extractFromInternalItemStorage(simulatedRequirements, internalStorage, Action.SIMULATE) != null) {
|
||||||
|
|
||||||
|
var actualRequirements = requirements.getSingleItemRequirementSet(false);
|
||||||
|
if(actualRequirements == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IoUtil.extractFromInternalItemStorage(actualRequirements, internalStorage, Action.PERFORM);
|
||||||
|
|
||||||
ItemStack output = getPattern().getOutput(recipe, network.getLevel().registryAccess());
|
ItemStack output = getPattern().getOutput(recipe, network.getLevel().registryAccess());
|
||||||
|
|
||||||
|
@@ -90,7 +90,7 @@ public class NodeRequirements {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Bad!");
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ public class NodeRequirements {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalStateException("Bad!");
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -121,10 +121,20 @@ public class ProcessingNode extends Node {
|
|||||||
|
|
||||||
boolean hasAllRequirements = false;
|
boolean hasAllRequirements = false;
|
||||||
|
|
||||||
List<ItemStack> extractedItems = IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(true), internalStorage, Action.SIMULATE);
|
var simulatedRequirements = requirements.getSingleItemRequirementSet(true);
|
||||||
|
if(simulatedRequirements == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ItemStack> extractedItems = IoUtil.extractFromInternalItemStorage(simulatedRequirements, internalStorage, Action.SIMULATE);
|
||||||
List<FluidStack> extractedFluids = null;
|
List<FluidStack> extractedFluids = null;
|
||||||
if (extractedItems != null) {
|
if (extractedItems != null) {
|
||||||
extractedFluids = IoUtil.extractFromInternalFluidStorage(requirements.getSingleFluidRequirementSet(true), internalFluidStorage, Action.SIMULATE);
|
var simulatedFluidRequirements = requirements.getSingleFluidRequirementSet(true);
|
||||||
|
if(simulatedFluidRequirements == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
extractedFluids = IoUtil.extractFromInternalFluidStorage(simulatedFluidRequirements, internalFluidStorage, Action.SIMULATE);
|
||||||
if (extractedFluids != null) {
|
if (extractedFluids != null) {
|
||||||
hasAllRequirements = true;
|
hasAllRequirements = true;
|
||||||
}
|
}
|
||||||
@@ -151,9 +161,17 @@ public class ProcessingNode extends Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.state = ProcessingState.READY;
|
this.state = ProcessingState.READY;
|
||||||
|
var actualRequirements = requirements.getSingleItemRequirementSet(false);
|
||||||
|
if(actualRequirements == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
extractedItems = IoUtil.extractFromInternalItemStorage(actualRequirements, internalStorage, Action.PERFORM);
|
||||||
|
|
||||||
extractedItems = IoUtil.extractFromInternalItemStorage(requirements.getSingleItemRequirementSet(false), internalStorage, Action.PERFORM);
|
var actualFluidRequirements = requirements.getSingleFluidRequirementSet(false);
|
||||||
extractedFluids = IoUtil.extractFromInternalFluidStorage(requirements.getSingleFluidRequirementSet(false), internalFluidStorage, Action.PERFORM);
|
if(actualFluidRequirements == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
extractedFluids = IoUtil.extractFromInternalFluidStorage(actualFluidRequirements, internalFluidStorage, Action.PERFORM);
|
||||||
|
|
||||||
container.insertItemsIntoInventory(extractedItems, Action.PERFORM);
|
container.insertItemsIntoInventory(extractedItems, Action.PERFORM);
|
||||||
container.insertFluidsIntoInventory(extractedFluids, Action.PERFORM);
|
container.insertFluidsIntoInventory(extractedFluids, Action.PERFORM);
|
||||||
|
Reference in New Issue
Block a user