Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retain the priority setting of the storage buses when wrenched #615

Merged
merged 2 commits into from
Nov 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/main/java/appeng/parts/misc/PartStorageBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.PartItemStack;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
Expand Down Expand Up @@ -114,6 +115,27 @@ public PartStorageBus(final ItemStack is) {
this.getConfigManager().registerSetting(Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY);
this.getConfigManager().registerSetting(Settings.STICKY_MODE, YesNo.NO);
this.mySrc = new MachineSource(this);
if (is.getTagCompound() != null) {
NBTTagCompound tag = is.getTagCompound();
if (tag.hasKey("priority")) {
priority = tag.getInteger("priority");
// if we don't do this, the tag will stick forever to the storage bus, as it's never cleaned up,
// even when the item is broken with a pickaxe
this.is.setTagCompound(null);
}
}
}

@Override
public ItemStack getItemStack(final PartItemStack type) {
if (type == PartItemStack.Wrench) {
final NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("priority", priority);
final ItemStack copy = this.is.copy();
copy.setTagCompound(tag);
return copy;
}
return super.getItemStack(type);
}

@Override
Expand Down