use of buildcraft.builders.item.ItemSnapshot in project BuildCraft by BuildCraft.
the class TileBuilder method onSlotChange.
@Override
protected void onSlotChange(IItemHandlerModifiable handler, int slot, @Nonnull ItemStack before, @Nonnull ItemStack after) {
if (!world.isRemote) {
if (handler == invSnapshot) {
currentBasePosIndex = 0;
snapshot = null;
if (after.getItem() instanceof ItemSnapshot) {
Snapshot.Header header = BCBuildersItems.snapshot.getHeader(after);
if (header != null) {
Snapshot newSnapshot = GlobalSavedDataSnapshots.get(world).getSnapshot(header.key);
if (newSnapshot != null) {
snapshot = newSnapshot;
}
}
}
updateSnapshot(true);
sendNetworkUpdate(NET_SNAPSHOT_TYPE);
}
if (handler == invResources) {
Optional.ofNullable(getBuilder()).ifPresent(SnapshotBuilder::resourcesChanged);
}
}
super.onSlotChange(handler, slot, before, after);
}
Aggregations