Skip to content

Commit

Permalink
retain the priority setting of the fluid storage buses when wrenched (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
boubou19 authored Nov 24, 2024
1 parent 9fb8bae commit be6dfac
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
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 @@ -97,6 +98,27 @@ public PartFluidStorageBus(ItemStack is) {
this.getConfigManager().registerSetting(Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY);
this.getConfigManager().registerSetting(Settings.STICKY_MODE, YesNo.NO);
this.source = 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

0 comments on commit be6dfac

Please sign in to comment.