Fixed slight performance issue with loading Crafters from disk. Fixes #2106

This commit is contained in:
raoulvdberge
2018-11-28 21:02:21 +01:00
parent 168c3c6a6b
commit 3fb53378ca
2 changed files with 17 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
### 1.6.12
- Increased the speed of autocrafting (raoulvdberge)
- Fixed External Storage sending storage updates when it is disabled (raoulvdberge)
- Fixed slight performance issue with loading Crafters from disk (raoulvdberge)
- Added a completion percentage to the Crafting Monitor (raoulvdberge)
- Updated Russian translation (kellixon)

View File

@@ -61,12 +61,14 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
protected void onContentsChanged(int slot) {
super.onContentsChanged(slot);
if (!world.isRemote) {
invalidate();
}
if (!reading) {
if (!world.isRemote) {
invalidate();
}
if (network != null) {
network.getCraftingManager().rebuild();
if (network != null) {
network.getCraftingManager().rebuild();
}
}
}
@@ -91,6 +93,8 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
private boolean locked = false;
private boolean wasPowered;
private boolean reading;
@Nullable
private String displayName;
@@ -171,12 +175,19 @@ public class NetworkNodeCrafter extends NetworkNode implements ICraftingPatternC
public void read(NBTTagCompound tag) {
super.read(tag);
// Fix cascading crafter invalidates while reading patterns
this.reading = true;
StackUtils.readItems(patternsInventory, 0, tag);
if (API.instance().getOneSixMigrationHelper().migratePatternInventory(patternsInventory)) {
markDirty();
}
this.invalidate();
this.reading = false;
StackUtils.readItems(upgrades, 1, tag);
if (tag.hasKey(NBT_DISPLAY_NAME)) {