From 1132d915039645f331443aaad377ad58424fbf73 Mon Sep 17 00:00:00 2001 From: preble Date: Thu, 7 Oct 2010 20:09:06 -0400 Subject: [PATCH] Progress snapshot. --- .gitignore | 3 +- English.lproj/MainMenu.xib | 969 ++++++++++++++--------- IJInventoryItem.h | 14 + IJInventoryItem.m | 37 + IJInventoryWindowController.h | 20 +- IJInventoryWindowController.m | 276 ++++++- IJItemPickerWindowController.h | 27 + IJItemPickerWindowController.m | 113 +++ IJMinecraftLevel.h | 8 + IJMinecraftLevel.m | 66 ++ InsideJob.xcodeproj/project.pbxproj | 14 + ItemPicker.xib | 1108 +++++++++++++++++++++++++++ Items.csv | 163 ++++ 13 files changed, 2429 insertions(+), 389 deletions(-) create mode 100644 IJItemPickerWindowController.h create mode 100644 IJItemPickerWindowController.m create mode 100644 ItemPicker.xib create mode 100644 Items.csv diff --git a/.gitignore b/.gitignore index 3dd36ad..63b3dfe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build *.perspectivev3 -*.pbxuser \ No newline at end of file +*.pbxuser +tmp \ No newline at end of file diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib index 42802ec..3e34e62 100644 --- a/English.lproj/MainMenu.xib +++ b/English.lproj/MainMenu.xib @@ -12,8 +12,8 @@ YES - - + + YES @@ -840,30 +840,30 @@ 256 YES - + 268 - {{85, 375}, {167, 26}} + {{17, 375}, {167, 26}} YES - + -2076049856 2048 - + LucidaGrande 13 1044 - + 109199615 129 400 75 - - - Item 1 + + + World 1 1048576 2147483647 @@ -871,38 +871,65 @@ _popUpItemAction: - + 1 + YES - + OtherViews YES - - - - Item 2 + + + + World 2 1048576 2147483647 _popUpItemAction: - + 2 + - - - Item 3 + + + World 3 1048576 2147483647 _popUpItemAction: - + 3 + + + + + World 4 + + 1048576 + 2147483647 + + + _popUpItemAction: + 4 + + + + + World 5 + + 1048576 + 2147483647 + + + _popUpItemAction: + 5 + - + 1 YES @@ -910,89 +937,41 @@ 2 - - - 268 - {{37, 381}, {44, 17}} - - YES - - 68288064 - 71304192 - World: - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - controlTextColor - - 3 - MAA - - - - - - - 268 - {{16, 347}, {67, 17}} - - YES - - 68288064 - 71304192 - Inventory: - - - - - - - + 274 YES - - + + 2304 YES - - + + 4352 - {441, 323} - + {551, 342} + YES - - + + 256 - {441, 17} - - + {551, 17} + + - - + + -2147483392 {{427, 0}, {16, 17}} - + YES - + slot - 40 - 40 + 101 + 16 1000 75628096 @@ -1003,39 +982,149 @@ 11 3100 - + 3 MC4zMzMzMzI5ODU2AA - + 6 System headerTextColor - + + 3 + MAA + - + 337772096 2048 Text Cell - - - + + + 6 System controlBackgroundColor - + + 3 + MC42NjY2NjY2NjY3AA + - + + 6 + System + controlTextColor + + + + 3 + YES + + + + count + 64 + 10 + 3.4028234663852886e+38 + + 75628096 + 67110912 + Count + + + 6 + System + headerColor + + 3 + MQA + + + + + + 337772096 + -2080372736 + Text Cell + + + + YES + + YES + allowsFloats + formatterBehavior + locale + negativeInfinitySymbol + nilSymbol + positiveInfinitySymbol + + + YES + + + + + + -∞ + + +∞ + + + # + # + + + + + + + + NaN + + YES + + YES + + + YES + + + + + 0 + 0 + YES + NO + 1 + AAAAAAAAAAAAAAAAAAAAAA + + + + 3 + YES + YES + YES + + . + , + NO + NO + YES + + + + 3 YES YES - + - + item - 228 + 180 40 1000 @@ -1043,89 +1132,101 @@ 2048 Item - - + + - - -2076049856 + + 337772096 2048 - - - 100679935 - 129 - - - 400 - 75 - - - Pop Up - - 1048576 - 2147483647 - 1 - - - _popUpItemAction: - - - YES - - OtherViews - - YES - - - - - 3 - YES - YES - 1 + Text Cell + + + + 3 YES YES - + - - count - 80 + + id + 42 10 3.4028234663852886e+38 75628096 2048 - Count + Id - - 6 - System - headerColor - - 3 - MQA - - - + + - + 337772096 - 2048 + -2147481600 Text Cell - - - - + + + + YES + + YES + allowsFloats + formatterBehavior + locale + negativeInfinitySymbol + nilSymbol + positiveInfinitySymbol + + + YES + + + + -∞ + + +∞ + + + # + # + + + + + + + + NaN + + + + + + 3 + YES + YES + YES + + . + , + NO + NO + YES + + + + 3 YES YES - + - + damage - 81 + 46 10 3.4028234663852886e+38 @@ -1133,27 +1234,75 @@ 2048 Damage - - + + - + 337772096 - 2048 + -2147481600 Text Cell - - - - + + + + YES + + YES + allowsFloats + formatterBehavior + locale + negativeInfinitySymbol + nilSymbol + positiveInfinitySymbol + + + YES + + + + -∞ + + +∞ + + + # + # + + + + + + + + NaN + + + + + + 3 + YES + YES + YES + + . + , + NO + NO + YES + + + + 3 YES YES - + 3 2 - + 6 System @@ -1164,7 +1313,7 @@ 17 - -700448768 + -767557632 4 @@ -1174,57 +1323,58 @@ 0 - {{1, 17}, {441, 323}} - - - - + {{1, 17}, {551, 342}} + + + + 4 - - + + -2147483392 {{427, 17}, {15, 308}} - - + + _doScroller: - 0.95356037151702788 + 0.95614035087719296 - - + + -2147483392 {{1, 325}, {441, 15}} - + + YES 1 - + _doScroller: - 0.99773755656108598 + 0.96836555360281196 - - + + 2304 YES - + - {{1, 0}, {441, 17}} - - - - + {{1, 0}, {551, 17}} + + + + 4 - + - {{88, 23}, {443, 341}} + {{-1, -1}, {553, 360}} - - 562 - - - - - + + 690 + + + + + QSAAAEEgAABBmAAAQZgAAA @@ -1240,7 +1390,7 @@ NSFontManager - + IJInventoryWindowController @@ -1658,7 +1808,7 @@ window - + 534 @@ -1667,33 +1817,49 @@ delegate - + 535 dataSource - - + + - 562 + 578 delegate - - + + - 563 + 579 - tableView - - + outlineView + + - 564 + 580 + + + + worldPopup + + + + 583 + + + + worldSelectionChanged: + + + + 584 @@ -1701,9 +1867,7 @@ YES 0 - - YES - + @@ -2251,10 +2415,8 @@ YES - - - - + + @@ -2363,193 +2525,201 @@ 533 - + 536 - + YES - + 537 - + YES - + - + 538 - + YES - - - + + + + + - + 539 - - + + 540 - - + + 541 - - + + - 542 - + 565 + YES - + + + + - 543 - - + 566 + + - 544 - + 567 + + + + + 568 + YES - - - - + + + + + - + - 545 - - + 569 + + - 546 - - - - - 547 - + 570 + YES - - - - + - + - 548 - - - - - 549 - + 571 + YES - + - + - 550 - + 572 + + + + + 573 + + + + + 574 + YES - + - + - 552 - - - - - 553 - + 575 + YES - + - + - 554 - - - - - 555 - + 576 + YES - + - + - 556 - - - - - 557 - + 577 + YES - + - + - 558 - - + 581 + + - 559 - + 582 + + + + + 585 + + + + + 586 + + + + + 587 + YES - + - + - 560 - + 588 + YES - + - + - 561 - - + 589 + + @@ -2716,36 +2886,39 @@ 536.IBPluginDependency 536.IBViewBoundsToFrameTransform 537.IBPluginDependency + 538.IBEditorWindowLastContentRect 538.IBPluginDependency 539.IBPluginDependency 540.IBPluginDependency 541.IBPluginDependency - 542.IBPluginDependency - 542.IBViewBoundsToFrameTransform - 543.IBPluginDependency - 544.IBPluginDependency - 544.IBViewBoundsToFrameTransform - 545.IBPluginDependency - 546.IBPluginDependency - 547.IBPluginDependency - 548.IBPluginDependency - 549.IBPluginDependency - 550.IBPluginDependency - 552.IBPluginDependency - 553.IBPluginDependency - 553.IBViewBoundsToFrameTransform - 554.IBPluginDependency - 559.IBPluginDependency 56.IBPluginDependency 56.ImportedFromIB2 - 560.IBPluginDependency - 561.IBPluginDependency + 565.IBPluginDependency + 566.IBPluginDependency + 567.IBPluginDependency + 568.IBPluginDependency + 569.IBPluginDependency 57.IBEditorWindowLastContentRect 57.IBPluginDependency 57.ImportedFromIB2 57.editorWindowContentRectSynchronizationRect + 570.IBPluginDependency + 571.IBPluginDependency + 572.IBPluginDependency + 573.IBPluginDependency 58.IBPluginDependency 58.ImportedFromIB2 + 581.IBNumberFormatterBehaviorMetadataKey + 581.IBNumberFormatterLocalizesFormatMetadataKey + 581.IBPluginDependency + 582.IBNumberFormatterBehaviorMetadataKey + 582.IBNumberFormatterLocalizesFormatMetadataKey + 582.IBPluginDependency + 585.IBPluginDependency + 586.IBPluginDependency + 589.IBNumberFormatterBehaviorMetadataKey + 589.IBNumberFormatterLocalizesFormatMetadataKey + 589.IBPluginDependency 72.IBPluginDependency 72.ImportedFromIB2 73.IBPluginDependency @@ -2933,45 +3106,42 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABC1gAAw6oAAA + P4AAAL+AAABBiAAAw8oAAA com.apple.InterfaceBuilder.CocoaPlugin + {{167, 432}, {167, 103}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABCFAAAw8YAAA - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABCsAAAw7KAAA - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABCKAAAw8OAAA - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{286, 129}, {275, 183}} com.apple.InterfaceBuilder.CocoaPlugin {{23, 794}, {245, 183}} com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + com.apple.InterfaceBuilder.CocoaPlugin + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2988,7 +3158,7 @@ com.apple.InterfaceBuilder.CocoaPlugin - {{452, 109}, {196, 203}} + {{478, 633}, {196, 203}} com.apple.InterfaceBuilder.CocoaPlugin {{145, 474}, {199, 203}} @@ -3016,7 +3186,7 @@ - 564 + 589 @@ -3024,15 +3194,47 @@ IJInventoryWindowController NSWindowController + + worldSelectionChanged: + id + + + worldSelectionChanged: + + worldSelectionChanged: + id + + - tableView - NSTableView + YES + + YES + outlineView + worldPopup + + + YES + NSOutlineView + NSPopUpButton + - tableView - - tableView - NSTableView + YES + + YES + outlineView + worldPopup + + + YES + + outlineView + NSOutlineView + + + worldPopup + NSPopUpButton + @@ -3338,6 +3540,14 @@ AppKit.framework/Headers/NSMovieView.h + + NSNumberFormatter + NSFormatter + + IBFrameworkSource + Foundation.framework/Headers/NSNumberFormatter.h + + NSObject @@ -3406,7 +3616,7 @@ NSObject - + IBFrameworkSource AppKit.framework/Headers/NSOutlineView.h @@ -3579,6 +3789,11 @@ Foundation.framework/Headers/NSURLDownload.h + + NSOutlineView + NSTableView + + NSPopUpButton NSButton @@ -3655,14 +3870,6 @@ AppKit.framework/Headers/NSText.h - - NSTextField - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSTextField.h - - NSTextFieldCell NSActionCell diff --git a/IJInventoryItem.h b/IJInventoryItem.h index b239551..8484d04 100644 --- a/IJInventoryItem.h +++ b/IJInventoryItem.h @@ -8,6 +8,14 @@ #import +// See: http://www.minecraftwiki.net/wiki/Data_values +#define IJInventorySlotQuickFirst (0) +#define IJInventorySlotQuickLast (8) +#define IJInventorySlotNormalFirst (9) +#define IJInventorySlotNormalLast (35) +#define IJInventorySlotArmorLast (103) // head +#define IJInventorySlotArmorFirst (100) // feet + @interface IJInventoryItem : NSObject { uint16_t itemId; @@ -20,4 +28,10 @@ @property (nonatomic, assign) uint8_t count; @property (nonatomic, assign) uint8_t slot; +@property (nonatomic, readonly) NSString *itemName; + ++ (id)emptyItemWithSlot:(uint8_t)slot; + ++ (NSDictionary *)itemIdLookup; + @end diff --git a/IJInventoryItem.m b/IJInventoryItem.m index d1fd1fb..2fed41c 100644 --- a/IJInventoryItem.m +++ b/IJInventoryItem.m @@ -13,4 +13,41 @@ @synthesize itemId, slot, damage, count; ++ (id)emptyItemWithSlot:(uint8_t)slot +{ + IJInventoryItem *obj = [[[[self class] alloc] init] autorelease]; + obj.slot = slot; + return obj; +} + +- (NSString *)itemName +{ + NSString *name = [[IJInventoryItem itemIdLookup] objectForKey:[NSNumber numberWithShort:self.itemId]]; + if (name) + return name; + else + return [NSString stringWithFormat:@"%d", self.itemId]; +} + ++ (NSDictionary *)itemIdLookup +{ + static NSDictionary *lookup = nil; + if (!lookup) + { + NSError *error = nil; + NSString *lines = [NSString stringWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"Items" withExtension:@"csv"] + encoding:NSUTF8StringEncoding + error:&error]; + NSMutableDictionary *building = [NSMutableDictionary dictionary]; + [lines enumerateLinesUsingBlock:^(NSString *line, BOOL *stop) { + NSArray *components = [line componentsSeparatedByString:@","]; + NSNumber *itemId = [NSNumber numberWithShort:[[components objectAtIndex:0] intValue]]; + NSString *name = [components objectAtIndex:1]; + [building setObject:name forKey:itemId]; + }]; + lookup = [[NSDictionary alloc] initWithDictionary:building]; + } + return lookup; +} + @end diff --git a/IJInventoryWindowController.h b/IJInventoryWindowController.h index 983c979..5e401de 100644 --- a/IJInventoryWindowController.h +++ b/IJInventoryWindowController.h @@ -8,9 +8,27 @@ #import +@class IJMinecraftLevel; @interface IJInventoryWindowController : NSWindowController { - + IJMinecraftLevel *level; + NSArray *inventory; + + NSOutlineView *outlineView; + NSPopUpButton *worldPopup; + + NSArray *rootItems; + NSMutableArray *armorItem; + NSMutableArray *quickItem; + NSMutableArray *inventoryItem; + + BOOL dirty; + int64_t sessionLockValue; } +@property (nonatomic, assign) IBOutlet NSOutlineView *outlineView; +@property (nonatomic, assign) IBOutlet NSPopUpButton *worldPopup; + +- (IBAction)worldSelectionChanged:(id)sender; + @end diff --git a/IJInventoryWindowController.m b/IJInventoryWindowController.m index cb61400..a9b0955 100644 --- a/IJInventoryWindowController.m +++ b/IJInventoryWindowController.m @@ -7,24 +7,288 @@ // #import "IJInventoryWindowController.h" - +#import "IJMinecraftLevel.h" +#import "IJInventoryItem.h" +#import "IJItemPickerWindowController.h" @implementation IJInventoryWindowController +@synthesize outlineView; +@synthesize worldPopup; -- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView + +- (void)awakeFromNib { - return 0; + armorItem = [NSMutableArray array]; + quickItem = [NSMutableArray array]; + inventoryItem = [NSMutableArray array]; + rootItems = [[NSArray alloc] initWithObjects:armorItem, quickItem, inventoryItem, nil]; + + [self worldSelectionChanged:nil]; + + [outlineView expandItem:nil expandChildren:YES]; +} +- (void)dealloc +{ + [inventory release]; + [rootItems release]; + [level release]; + [super dealloc]; } -- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row + +#pragma mark - +#pragma mark World Selection + +- (void)loadWorldAtIndex:(int)worldIndex { + [armorItem removeAllObjects]; + [quickItem removeAllObjects]; + [inventoryItem removeAllObjects]; + + sessionLockValue = [IJMinecraftLevel writeToSessionLockAtIndex:worldIndex]; + if (![IJMinecraftLevel checkSessionLockAtIndex:worldIndex value:sessionLockValue]) + { + NSBeginCriticalAlertSheet(@"Error loading world.", @"Dismiss", nil, nil, self.window, nil, nil, nil, nil, @"Inside Job was unable obtain the session lock."); + return; + } + + NSString *levelPath = [IJMinecraftLevel pathForLevelDatAtIndex:worldIndex]; + + NSData *fileData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:levelPath]]; + + if (!fileData) + { + // Error loading + [outlineView reloadData]; + NSBeginCriticalAlertSheet(@"Error loading world.", @"Dismiss", nil, nil, self.window, nil, nil, nil, nil, @"InsideJob was unable to load the level at %@.", levelPath); + return; + } + + [level release]; + level = [[IJMinecraftLevel nbtContainerWithData:fileData] retain]; + inventory = [[level inventory] retain]; + + // Add placeholder inventory items: + + for (int i = 0; i < IJInventorySlotQuickLast + 1 - IJInventorySlotQuickFirst; i++) + [quickItem addObject:[IJInventoryItem emptyItemWithSlot:IJInventorySlotQuickFirst + i]]; + + for (int i = 0; i < IJInventorySlotNormalLast + 1 - IJInventorySlotNormalFirst; i++) + [inventoryItem addObject:[IJInventoryItem emptyItemWithSlot:IJInventorySlotNormalFirst + i]]; + + for (int i = 0; i < IJInventorySlotArmorLast + 1 - IJInventorySlotArmorFirst; i++) + [armorItem addObject:[IJInventoryItem emptyItemWithSlot:IJInventorySlotArmorFirst + i]]; + + + // Overwrite the placeholders with actual inventory: + + for (IJInventoryItem *item in inventory) + { + if (IJInventorySlotQuickFirst <= item.slot && item.slot <= IJInventorySlotQuickLast) + { + [quickItem replaceObjectAtIndex:item.slot - IJInventorySlotQuickFirst withObject:item]; + } + else if (IJInventorySlotNormalFirst <= item.slot && item.slot <= IJInventorySlotNormalLast) + { + [inventoryItem replaceObjectAtIndex:item.slot - IJInventorySlotNormalFirst withObject:item]; + } + else if (IJInventorySlotArmorFirst <= item.slot && item.slot <= IJInventorySlotArmorLast) + { + [armorItem replaceObjectAtIndex:item.slot - IJInventorySlotArmorFirst withObject:item]; + } + } + + [outlineView reloadData]; +} + +- (void)saveToWorldAtIndex:(int)worldIndex +{ + if (![IJMinecraftLevel checkSessionLockAtIndex:worldIndex value:sessionLockValue]) + { + NSBeginCriticalAlertSheet(@"Another application has modified this world.", @"Dismiss", nil, nil, self.window, nil, nil, nil, nil, @"The session lock was changed by another application."); + return; + } + + NSString *levelPath = [IJMinecraftLevel pathForLevelDatAtIndex:worldIndex]; + + NSMutableArray *newInventory = [NSMutableArray array]; + + for (NSArray *items in rootItems) + { + for (IJInventoryItem *item in items) + { + if (item.count > 0 && item.itemId > 0) + [newInventory addObject:item]; + } + } + + [level setInventory:newInventory]; + + NSString *backupPath = [levelPath stringByAppendingPathExtension:@".insidejobbackup"]; + + BOOL success; + NSError *error = nil; + success = [[NSFileManager defaultManager] removeItemAtPath:backupPath error:&error]; + success = [[NSFileManager defaultManager] copyItemAtPath:levelPath + toPath:backupPath + error:&error]; + if (!success) + { + NSBeginCriticalAlertSheet(@"An error occurred while saving.", @"Dismiss", nil, nil, self.window, nil, nil, nil, nil, @"Inside Job was unable to create a backup of the existing level file."); + return; + } + + [[level writeData] writeToURL:[NSURL fileURLWithPath:levelPath] atomically:NO]; +} + +#pragma mark - +#pragma mark Actions + +- (IBAction)worldSelectionChanged:(id)sender +{ + int worldIndex = [[worldPopup selectedItem] tag]; + [self loadWorldAtIndex:worldIndex]; +} + +- (void)saveDocument:(id)sender +{ + int worldIndex = [[worldPopup selectedItem] tag]; + [self saveToWorldAtIndex:worldIndex]; +} + + +#pragma mark - +#pragma mark Inventory Outline View + +- (id)outlineView:(NSOutlineView *)theOutlineView child:(NSInteger)index ofItem:(id)item +{ + if (item == nil) + { + return [rootItems objectAtIndex:index]; + } + else + { + return [item objectAtIndex:index]; + } + +} + +- (BOOL)outlineView:(NSOutlineView *)theOutlineView isItemExpandable:(id)item +{ + return item == nil || [rootItems containsObject:item]; +} + +- (NSInteger)outlineView:(NSOutlineView *)theOutlineView numberOfChildrenOfItem:(id)item +{ + if (item == nil) + { + return 3; + } + else if ([rootItems containsObject:item]) + { + return [(NSArray *)item count]; + } + else + { + return 0; + } + +} + +- (id)outlineView:(NSOutlineView *)theOutlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item +{ + if ([rootItems containsObject:item]) + { + if ([tableColumn.identifier isEqual:@"slot"]) + { + if (item == armorItem) + return @"Armor"; + else if (item == quickItem) + return @"Quick Inventory"; + else if (item == inventoryItem) + return @"Inventory"; + } + else + { + return nil; + } + } + + IJInventoryItem *invItem = item; + + if ([tableColumn.identifier isEqual:@"slot"]) + { + return [NSString stringWithFormat:@"%d", invItem.slot]; + } + else if ([tableColumn.identifier isEqual:@"id"]) + { + if (invItem.itemId) + return [NSNumber numberWithShort:invItem.itemId]; + else + return nil; + } + else if ([tableColumn.identifier isEqual:@"item"]) + { + if (invItem.itemId) + return invItem.itemName; + else + return @""; + } + else if ([tableColumn.identifier isEqual:@"count"]) + { + if (invItem.count) + return [NSNumber numberWithUnsignedChar:invItem.count]; + else + return nil; + } + else if ([tableColumn.identifier isEqual:@"damage"]) + { + if (invItem.damage) + return [NSNumber numberWithShort:invItem.damage]; + else + return nil; + } + return nil; } -- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row +- (void)outlineView:(NSOutlineView *)theOutlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { - + IJInventoryItem *invItem = item; + if ([tableColumn.identifier isEqual:@"id"]) + { + invItem.itemId = [object shortValue]; + } + else if ([tableColumn.identifier isEqual:@"count"]) + { + invItem.count = [object unsignedCharValue]; + if (invItem.count > 64) + invItem.count = 64; + } + else if ([tableColumn.identifier isEqual:@"damage"]) + { + invItem.damage = [object shortValue]; + } +} + +- (BOOL)outlineView:(NSOutlineView *)theOutlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item +{ + if ([rootItems containsObject:item]) + return NO; + else if ([tableColumn.identifier isEqual:@"item"]) + { + IJInventoryItem *invItem = item; + [[IJItemPickerWindowController sharedController] showPickerWithInitialItemId:invItem.itemId completionBlock:^(uint16_t itemId) { + invItem.itemId = itemId; + [outlineView reloadItem:item]; + }]; + return NO; + } + else + { + return [tableColumn.identifier isEqual:@"slot"] == NO; + } } diff --git a/IJItemPickerWindowController.h b/IJItemPickerWindowController.h new file mode 100644 index 0000000..99000a2 --- /dev/null +++ b/IJItemPickerWindowController.h @@ -0,0 +1,27 @@ +// +// IJItemPickerWindowController.h +// InsideJob +// +// Created by Adam Preble on 10/7/10. +// Copyright 2010 Adam Preble. All rights reserved. +// + +#import + + +@interface IJItemPickerWindowController : NSWindowController { + void(^completionBlock)(uint16_t itemId); + NSTableView *tableView; + NSArray *allItemIds; + NSArray *filteredItemIds; +} +@property (nonatomic, assign) IBOutlet NSTableView *tableView; + ++ (IJItemPickerWindowController *)sharedController; + +- (void)showPickerWithInitialItemId:(uint16_t)initialItemId completionBlock:(void(^)(uint16_t itemId))block; + +- (IBAction)itemActivated:(id)sender; +- (IBAction)updateFilter:(id)sender; + +@end diff --git a/IJItemPickerWindowController.m b/IJItemPickerWindowController.m new file mode 100644 index 0000000..7b46835 --- /dev/null +++ b/IJItemPickerWindowController.m @@ -0,0 +1,113 @@ +// +// IJItemPickerWindowController.m +// InsideJob +// +// Created by Adam Preble on 10/7/10. +// Copyright 2010 Adam Preble. All rights reserved. +// + +#import "IJItemPickerWindowController.h" +#import "IJInventoryItem.h" + +@implementation IJItemPickerWindowController + +@synthesize tableView; + ++ (IJItemPickerWindowController *)sharedController +{ + static IJItemPickerWindowController *globalSharedController = nil; + if (!globalSharedController) + { + globalSharedController = [[IJItemPickerWindowController alloc] initWithWindowNibName:@"ItemPicker"]; + } + return globalSharedController; +} + +- (void)awakeFromNib +{ + [tableView setTarget:self]; + [tableView setDoubleAction:@selector(itemActivated:)]; + + NSArray *keys = [[IJInventoryItem itemIdLookup] allKeys]; + keys = [keys sortedArrayUsingSelector:@selector(compare:)]; + allItemIds = [[NSArray alloc] initWithArray:keys]; + filteredItemIds = [allItemIds retain]; +} + +- (void)showPickerWithInitialItemId:(uint16_t)initialItemId completionBlock:(void(^)(uint16_t itemId))theBlock +{ + [self showWindow:nil]; + + [completionBlock autorelease]; + completionBlock = [theBlock copy]; + + NSUInteger row = [filteredItemIds indexOfObject:[NSNumber numberWithShort:initialItemId]]; + if (row != NSNotFound) + { + [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; + [tableView scrollRowToVisible:row]; + } +} + +- (IBAction)updateFilter:(id)sender +{ + NSString *filterString = [sender stringValue]; + + if (filterString.length == 0) + { + [filteredItemIds autorelease]; + filteredItemIds = [allItemIds retain]; + [tableView reloadData]; + return; + } + + NSMutableArray *results = [NSMutableArray array]; + + for (NSNumber *itemId in allItemIds) + { + NSString *name = [[IJInventoryItem itemIdLookup] objectForKey:itemId]; + NSRange range = [name rangeOfString:filterString options:NSCaseInsensitiveSearch]; + if (range.location != NSNotFound) + [results addObject:itemId]; + } + + [filteredItemIds autorelease]; + filteredItemIds = [results retain]; + [tableView reloadData]; +} + +- (IBAction)itemActivated:(id)sender +{ + NSUInteger row = [tableView selectedRow]; + uint16_t itemId = [[filteredItemIds objectAtIndex:row] shortValue]; + + [[self window] orderOut:nil]; + + completionBlock(itemId); +} + +#pragma mark - +#pragma mark NSTableViewDataSource + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)theTableView +{ + return filteredItemIds.count; +} +- (id)tableView:(NSTableView *)theTableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row +{ + // TODO: Change this, because the row will not correspond once we support sorting. + NSNumber *itemId = [filteredItemIds objectAtIndex:row]; + + if ([tableColumn.identifier isEqual:@"itemId"]) + return [itemId stringValue]; + + NSString *name = [[IJInventoryItem itemIdLookup] objectForKey:itemId]; + return name; +} + +- (void)windowDidResignKey:(NSNotification *)notification +{ + [[self window] orderOut:nil]; +} + +@end diff --git a/IJMinecraftLevel.h b/IJMinecraftLevel.h index 5e1e25f..7e4e2d4 100644 --- a/IJMinecraftLevel.h +++ b/IJMinecraftLevel.h @@ -15,4 +15,12 @@ @property (nonatomic, copy) NSArray *inventory; // Array of IJInventoryItem objects. ++ (NSString *)pathForWorldAtIndex:(int)worldIndex; ++ (NSString *)pathForLevelDatAtIndex:(int)worldIndex; ++ (NSString *)pathForSessionLockAtIndex:(int)worldIndex; + ++ (int64_t)writeToSessionLockAtIndex:(int)worldIndex; ++ (BOOL)checkSessionLockAtIndex:(int)worldIndex value:(int64_t)checkValue; + + @end diff --git a/IJMinecraftLevel.m b/IJMinecraftLevel.m index 0bb632c..1a0ced1 100644 --- a/IJMinecraftLevel.m +++ b/IJMinecraftLevel.m @@ -69,4 +69,70 @@ inventoryList.children = newChildren; } +#pragma mark - +#pragma mark Helpers + ++ (NSString *)pathForWorldAtIndex:(int)worldIndex +{ + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + NSString *path = [paths objectAtIndex:0]; + path = [path stringByAppendingPathComponent:@"minecraft"]; + path = [path stringByAppendingPathComponent:@"saves"]; + path = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"World%d", worldIndex]]; + return path; +} + ++ (NSString *)pathForLevelDatAtIndex:(int)worldIndex +{ + return [[[self class] pathForWorldAtIndex:worldIndex] stringByAppendingPathComponent:@"level.dat"]; +} ++ (NSString *)pathForSessionLockAtIndex:(int)worldIndex +{ + return [[[self class] pathForWorldAtIndex:worldIndex] stringByAppendingPathComponent:@"session.lock"]; +} + + + ++ (NSData *)dataWithInt64:(int64_t)v +{ + NSMutableData *data = [NSMutableData data]; + uint32_t v0 = htonl(v >> 32); + uint32_t v1 = htonl(v); + [data appendBytes:&v0 length:4]; + [data appendBytes:&v1 length:4]; + return data; +} ++ (int64_t)int64FromData:(NSData *)data +{ + uint8_t *bytes = (uint8_t *)[data bytes]; + uint64_t n = ntohl(*((uint32_t *)(bytes + 0))); + n <<= 32; + n += ntohl(*((uint32_t *)(bytes + 4))); + return n; +} + ++ (int64_t)writeToSessionLockAtIndex:(int)worldIndex +{ + NSString *path = [IJMinecraftLevel pathForSessionLockAtIndex:worldIndex]; + NSDate *now = [NSDate date]; + NSTimeInterval interval = [now timeIntervalSince1970]; + int64_t milliseconds = (int64_t)(interval * 1000.0); + // write as number of milliseconds + + NSData *data = [IJMinecraftLevel dataWithInt64:milliseconds]; + [data writeToFile:path atomically:YES]; + + return milliseconds; +} + ++ (BOOL)checkSessionLockAtIndex:(int)worldIndex value:(int64_t)checkValue +{ + NSString *path = [IJMinecraftLevel pathForSessionLockAtIndex:worldIndex]; + NSData *data = [NSData dataWithContentsOfFile:path]; + + int64_t milliseconds = [IJMinecraftLevel int64FromData:data]; + return checkValue == milliseconds; +} + + @end diff --git a/InsideJob.xcodeproj/project.pbxproj b/InsideJob.xcodeproj/project.pbxproj index eff2067..2c8de14 100644 --- a/InsideJob.xcodeproj/project.pbxproj +++ b/InsideJob.xcodeproj/project.pbxproj @@ -15,6 +15,9 @@ 668B27AF125D8EFD0060BF71 /* IJMinecraftLevel.m in Sources */ = {isa = PBXBuildFile; fileRef = 668B27AE125D8EFD0060BF71 /* IJMinecraftLevel.m */; }; 668B27B2125D8F8E0060BF71 /* IJInventoryItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 668B27B1125D8F8E0060BF71 /* IJInventoryItem.m */; }; 668B27F2125D963F0060BF71 /* IJInventoryWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 668B27F1125D963F0060BF71 /* IJInventoryWindowController.m */; }; + 668B290F125E40560060BF71 /* Items.csv in Resources */ = {isa = PBXBuildFile; fileRef = 668B28D8125E370A0060BF71 /* Items.csv */; }; + 668B2979125E5DD40060BF71 /* IJItemPickerWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 668B2978125E5DD40060BF71 /* IJItemPickerWindowController.m */; }; + 668B297C125E5DF00060BF71 /* ItemPicker.xib in Resources */ = {isa = PBXBuildFile; fileRef = 668B297B125E5DF00060BF71 /* ItemPicker.xib */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; @@ -42,6 +45,10 @@ 668B27B1125D8F8E0060BF71 /* IJInventoryItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJInventoryItem.m; sourceTree = ""; }; 668B27F0125D963F0060BF71 /* IJInventoryWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJInventoryWindowController.h; sourceTree = ""; }; 668B27F1125D963F0060BF71 /* IJInventoryWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJInventoryWindowController.m; sourceTree = ""; }; + 668B28D8125E370A0060BF71 /* Items.csv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Items.csv; sourceTree = ""; }; + 668B2977125E5DD40060BF71 /* IJItemPickerWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IJItemPickerWindowController.h; sourceTree = ""; }; + 668B2978125E5DD40060BF71 /* IJItemPickerWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IJItemPickerWindowController.m; sourceTree = ""; }; + 668B297B125E5DF00060BF71 /* ItemPicker.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ItemPicker.xib; sourceTree = ""; }; 8D1107310486CEB800E47090 /* InsideJob-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "InsideJob-Info.plist"; sourceTree = ""; }; 8D1107320486CEB800E47090 /* InsideJob.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InsideJob.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -125,6 +132,8 @@ 8D1107310486CEB800E47090 /* InsideJob-Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + 668B297B125E5DF00060BF71 /* ItemPicker.xib */, + 668B28D8125E370A0060BF71 /* Items.csv */, ); name = Resources; sourceTree = ""; @@ -165,6 +174,8 @@ children = ( 668B27F0125D963F0060BF71 /* IJInventoryWindowController.h */, 668B27F1125D963F0060BF71 /* IJInventoryWindowController.m */, + 668B2977125E5DD40060BF71 /* IJItemPickerWindowController.h */, + 668B2978125E5DD40060BF71 /* IJItemPickerWindowController.m */, ); name = Interface; sourceTree = ""; @@ -224,6 +235,8 @@ files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, + 668B290F125E40560060BF71 /* Items.csv in Resources */, + 668B297C125E5DF00060BF71 /* ItemPicker.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -241,6 +254,7 @@ 668B27AF125D8EFD0060BF71 /* IJMinecraftLevel.m in Sources */, 668B27B2125D8F8E0060BF71 /* IJInventoryItem.m in Sources */, 668B27F2125D963F0060BF71 /* IJInventoryWindowController.m in Sources */, + 668B2979125E5DD40060BF71 /* IJItemPickerWindowController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ItemPicker.xib b/ItemPicker.xib new file mode 100644 index 0000000..ee504dc --- /dev/null +++ b/ItemPicker.xib @@ -0,0 +1,1108 @@ + + + + 1060 + 10F569 + 804 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 804 + + + YES + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + IJItemPickerWindowController + + + FirstResponder + + + NSApplication + + + 27 + 2 + {{577, 347}, {249, 286}} + -1535637504 + Item Picker + NSPanel + + {1.79769e+308, 1.79769e+308} + + + 256 + + YES + + + 266 + {{6, 256}, {237, 22}} + + YES + + 343014976 + 272630848 + + + LucidaGrande + 13 + 1044 + + + YES + 1 + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + 130560 + 0 + search + + _searchFieldSearch: + + 138690815 + 0 + + 400 + 75 + + + 130560 + 0 + clear + + YES + + YES + + YES + AXDescription + NSAccessibilityEncodedAttributesValueType + + + YES + cancel + + + + + + _searchFieldCancel: + + 138690815 + 0 + + 400 + 75 + + 255 + CAAAAA + + + + + 274 + + YES + + + 2304 + + YES + + + 256 + {249, 247} + + YES + + + -2147483392 + {{224, 0}, {16, 17}} + + + YES + + itemId + 50 + 40 + 1000 + + 75628096 + 67110912 + + + LucidaGrande + 11 + 3100 + + + 3 + MC4zMzMzMzI5ODU2AA + + + 6 + System + headerTextColor + + + + + 337772096 + 67110912 + Text Cell + + + + 6 + System + controlBackgroundColor + + 3 + MC42NjY2NjY2NjY3AA + + + + + 3 + YES + + + + name + 191 + 10 + 3.4028234663852886e+38 + + 75628096 + 2048 + + + + 6 + System + headerColor + + + + + + 337772096 + 2048 + Text Cell + + + + + + 3 + YES + YES + + + + 3 + 2 + + + 6 + System + gridColor + + 3 + MC41AA + + + 17 + 1444937728 + + + 0 + 15 + 0 + YES + 0 + + + {{1, 1}, {249, 247}} + + + + + 4 + + + + -2147483392 + {{224, 17}, {15, 102}} + + + _doScroller: + 0.99596774193548387 + + + + -2147483392 + {{-100, -100}, {145, 15}} + + 1 + + _doScroller: + 0.996 + + + {{-1, -1}, {251, 249}} + + + 530 + + + + QSAAAEEgAABBmAAAQZgAAA + + + {249, 286} + + + {{0, 0}, {1440, 878}} + {1.79769e+308, 1.79769e+308} + 27 + + + + + YES + + + window + + + + 5 + + + + delegate + + + + 6 + + + + initialFirstResponder + + + + 9 + + + + tableView + + + + 19 + + + + dataSource + + + + 20 + + + + delegate + + + + 21 + + + + updateFilter: + + + + 22 + + + + nextKeyView + + + + 23 + + + + nextKeyView + + + + 24 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 3 + + + YES + + + + + + 4 + + + YES + + + + + + + 7 + + + YES + + + + + + 8 + + + + + 10 + + + YES + + + + + + + + 11 + + + + + 12 + + + + + 13 + + + YES + + + + + + + 15 + + + YES + + + + + + 18 + + + + + 26 + + + YES + + + + + + 27 + + + + + + + YES + + YES + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 15.IBPluginDependency + 18.IBPluginDependency + 3.IBEditorWindowLastContentRect + 3.IBPluginDependency + 3.IBWindowTemplateEditedContentRect + 3.NSWindowTemplate.visibleAtLaunch + 4.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{538, 134}, {249, 286}} + com.apple.InterfaceBuilder.CocoaPlugin + {{538, 134}, {249, 286}} + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 27 + + + + YES + + IJItemPickerWindowController + NSWindowController + + YES + + YES + itemActivated: + updateFilter: + + + YES + id + id + + + + YES + + YES + itemActivated: + updateFilter: + + + YES + + itemActivated: + id + + + updateFilter: + id + + + + + tableView + NSTableView + + + tableView + + tableView + NSTableView + + + + IBProjectSource + IJItemPickerWindowController.h + + + + + YES + + NSActionCell + NSCell + + IBFrameworkSource + AppKit.framework/Headers/NSActionCell.h + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSCell + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSCell.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSPanel + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSPanel.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSScrollView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSScrollView.h + + + + NSScroller + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSScroller.h + + + + NSSearchField + NSTextField + + IBFrameworkSource + AppKit.framework/Headers/NSSearchField.h + + + + NSSearchFieldCell + NSTextFieldCell + + IBFrameworkSource + AppKit.framework/Headers/NSSearchFieldCell.h + + + + NSTableColumn + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableColumn.h + + + + NSTableView + NSControl + + + + NSTextField + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTextField.h + + + + NSTextFieldCell + NSActionCell + + IBFrameworkSource + AppKit.framework/Headers/NSTextFieldCell.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + NSWindowController + NSResponder + + showWindow: + id + + + showWindow: + + showWindow: + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSWindowController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + InsideJob.xcodeproj + 3 + + diff --git a/Items.csv b/Items.csv new file mode 100644 index 0000000..f61582a --- /dev/null +++ b/Items.csv @@ -0,0 +1,163 @@ +1,Stone +2,Grass +3,Dirt +4,Cobblestone +5,Wood +6,Sapling +7,Bedrock +8,Water +9,Stationary Water +10,Lava +11,Stationary Lava +12,Sand +13,Gravel +14,Gold Ore +15,Iron Ore +16,Coal Ore +17,Log +18,Leaves +19,Sponge +20,Glass +35,White Cloth +37,Yellow Flower +38,Red Rose +39,Brown Mushroom +40,Red Mushroom +41,Gold Block +42,Iron Block +43,Double Step +44,Step +45,Brick +46,TNT +47,Bookcase +48,Mossy Cobblestone +49,Obsidian +50,Torch +51,Fire +52,Mob Spawner +53,Wooden Stairs +54,Chest +55,Redstone Wire +56,Diamond Ore +57,Diamond Block +58,Workbench +59,Crops +60,Soil +61,Furnace +62,Burning Furnace +63,Sign Post +64,Wooden Door +65,Ladder +66,Minecart Tracks +67,Cobblestone Stairs +68,Wall Sign +69,Lever +70,Stone Pressure Plate +71,Iron Door +72,Wooden Pressure Plate +73,Redstone Ore +74,Glowing Redstone Ore +75,Redstone Torch (Off) +76,Redstone Torch (On) +77,Stone Button +78,Snow +79,Ice +80,Snow Block +81,Cactus +82,Clay +83,Reed +84,Jukebox +85,Fence +256,Iron Spade +257,Iron Pickaxe +258,Iron Axe +259,Flint and Steel +260,Apple +261,Bow +262,Arrow +263,Coal +264,Diamond +265,Iron Ingot +266,Gold Ingot +267,Iron Sword +268,Wooden Sword +269,Wooden Spade +270,Wooden Pickaxe +271,Woord Axe +272,Stone Sword +273,Stone Spade +274,Stone Pickaxe +275,Stone Axe +276,Diamond Sword +277,Diamond Spade +278,Diamond Pickaxe +279,Diamond Axe +280,Stick +281,Bowl +282,Mushroom Soup +283,Gold Sword +284,Gold Spade +285,Gold Pickaxe +286,Gold Axe +287,String +288,Feather +289,Gunpowder +290,Wooden Hoe +291,Stone Hoe +292,Iron Hoe +293,Diamond Hoe +294,Gold Hoe +295,Seeds +296,Wheat +297,Bread +298,Leather Helmet +299,Leather Chestplate +300,Leather Pants +301,Leather Boots +302,Chainmail Helmet +303,Chainmail Chestplate +304,Chainmail Pants +305,Chainmail Boots +306,Iron Helmet +307,Iron Chestplate +308,Iron Pants +309,Iron Boots +310,Diamond Helmet +311,Diamond Chestplate +312,Diamond Pants +313,Diamond Boots +314,Gold Helmet +315,Gold Chestplate +316,Gold Pants +317,Gold Boots +318,Flint +319,Pork +320,Grilled Pork +321,Paintings +322,Golden Apple +323,Sign +324,Wooden Door +325,Bucket +326,Water Bucket +327,Lava Bucket +328,Mine Cart +329,Saddle +330,Iron Door +331,Redstone +332,Snowball +333,Boat +334,Leather +335,Milk Bucket +336,Clay Brick +337,Clay Balls +338,Reed +339,Paper +340,Book +341,Slime Ball +342,Storage Minecart +343,Powered Minecart +344,Egg +345,Compass +346,Fishing Rod +2256,Gold Record +2257,Green Record