Skip to content

Commit

Permalink
Bumped version to 0.8.2.
Browse files Browse the repository at this point in the history
Added new Minecraft version 1.3 items.
Added loading of custom item types from a csv file in the InvGrid settings directory called items.csv.
Changed File->Open dialog so it automatically opens to the Minecraft saves directory.
  • Loading branch information
jbendig committed Feb 26, 2011
1 parent be9b8b2 commit 39a121a
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -49,7 +49,7 @@ INSTALL(FILES invgrid.png DESTINATION share/pixmaps)

SET(CPACK_GENERATOR DEB)
SET(CPACK_PACKAGE_NAME InvGrid)
SET(CPACK_PACKAGE_VERSION 0.8.1)
SET(CPACK_PACKAGE_VERSION 0.8.2)
SET(CPACK_PACKAGE_CONTACT "James Bendig <jbendig@starbytesoftware.com>")

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "InvGrid is a simple inventory editor for Minecraft.")
Expand Down
2 changes: 1 addition & 1 deletion Info.plist
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleIdentifier</key>
<string>InvGrid</string>
<key>CFBundleVersion</key>
<string>0.8.1</string>
<string>0.8.2</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleExecutable</key>
Expand Down
59 changes: 46 additions & 13 deletions Item.cpp
@@ -1,7 +1,11 @@
#include "Item.h"
#include <iostream>
#include <fstream>
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include "FilePath.h"
using std::ifstream;

namespace
{
Expand Down Expand Up @@ -214,17 +218,8 @@ ItemTypeBimap CreateItemTypeBimap()
ADD_ITEM_TYPE(23,"Dispenser");
ADD_ITEM_TYPE(24,"Sandstone");
ADD_ITEM_TYPE(25,"Note Block");
//ADD_ITEM_TYPE(26,"Aqua Green Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
//ADD_ITEM_TYPE(27,"Cyan Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
//ADD_ITEM_TYPE(28,"Blue Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
//ADD_ITEM_TYPE(29,"Purple Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
//ADD_ITEM_TYPE(30,"Indigo Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
//ADD_ITEM_TYPE(31,"Violet Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
//ADD_ITEM_TYPE(32,"Magenta Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
//ADD_ITEM_TYPE(33,"Pink Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
//ADD_ITEM_TYPE(34,"Black Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
ADD_ITEM_TYPE(35,"Gray Cloth");
//ADD_ITEM_TYPE(36,"Cloth"); //Not a real item, adjust Gray Cloth's damage instead.
//ADD_ITEM_TYPE(26,"Bed"); //World block, not for inventory.
ADD_ITEM_TYPE(35,"Wool");
ADD_ITEM_TYPE(37,"Yellow Flower");
ADD_ITEM_TYPE(38,"Red Rose");
ADD_ITEM_TYPE(39,"Brown Mushroom");
Expand Down Expand Up @@ -254,7 +249,7 @@ ItemTypeBimap CreateItemTypeBimap()
ADD_ITEM_TYPE(63,"Sign Post");
//ADD_ITEM_TYPE(64,"Wooden Door"); //Creates a rather useless half door that might cause Minecraft to crash.
ADD_ITEM_TYPE(65,"Ladder");
ADD_ITEM_TYPE(66,"Minecart Tracks");
ADD_ITEM_TYPE(66,"Rails");
ADD_ITEM_TYPE(67,"Cobblestone Stairs");
ADD_ITEM_TYPE(68,"Wall Sign");
ADD_ITEM_TYPE(69,"Lever");
Expand All @@ -281,6 +276,8 @@ ItemTypeBimap CreateItemTypeBimap()
ADD_ITEM_TYPE(90,"Portal");
ADD_ITEM_TYPE(91,"Jack-O-Lantern");
ADD_ITEM_TYPE(92,"Cake Block");
//ADD_ITEM_TYPE(93,"Redstone Repeater (\"off\" state)"); //Same as "Redstone Repeater" below
//ADD_ITEM_TYPE(94,"Redstone Repeater (\"on\" state)"); //Same as "Redstone Repeater" below

ADD_ITEM_TYPE(256,"Iron Shovel");
ADD_ITEM_TYPE(257,"Iron Pickaxe");
Expand Down Expand Up @@ -377,14 +374,50 @@ ItemTypeBimap CreateItemTypeBimap()
ADD_ITEM_TYPE(348,"Glowstone Dust");
ADD_ITEM_TYPE(349,"Raw Fish");
ADD_ITEM_TYPE(350,"Cooked Fish");
ADD_ITEM_TYPE(351,"Sack");
ADD_ITEM_TYPE(351,"Dye");
ADD_ITEM_TYPE(352,"Bone");
ADD_ITEM_TYPE(353,"Sugar");
ADD_ITEM_TYPE(354,"Cake");
ADD_ITEM_TYPE(355,"Bed");
ADD_ITEM_TYPE(356,"Redstone Repeater");
ADD_ITEM_TYPE(2256,"Gold Music Disc");
ADD_ITEM_TYPE(2257,"Green Music Disc");
#undef ADD_ITEM_TYPE

//Try and load a custom comma delimitered file that can overwrite default items.
//File has two columns in the order of: value,name
//Value must be a number and name should only use ASCII characters.
std::ifstream inFile((FilePath::GetInvGridSettingsDirectory() + "/items.csv").c_str());
while(inFile.good())
{
//Read a line.
string line;
std::getline(inFile,line);

//Split line by commas into 4 fields that make up the item.
vector<string> columns;
boost::split(columns,line,boost::algorithm::is_any_of(","),boost::token_compress_on);
if(columns.size() != 2)
continue;

try
{
const short value = boost::lexical_cast<short>(columns[0]);
const string name = columns[1];

//Delete any items that match value OR name.
itemTypeBimap.left.erase(value);
itemTypeBimap.right.erase(name);

//Add item or overwrite if one already exists with that value.
itemTypeBimap.insert(ItemTypeBimap::value_type(value,name));
}
catch(...)
{
//Invalid row, skip.
}
}

return itemTypeBimap;
}

Expand Down
5 changes: 3 additions & 2 deletions MainWindow.cpp
Expand Up @@ -126,7 +126,7 @@ MainWindow::MainWindow()
//Setup main window.
setCentralWidget(tabWidget);
resize(780,500);
setWindowTitle("InvGrid 0.8.1 | Simple Minecraft Inventory Editor");
setWindowTitle("InvGrid 0.8.2 | Simple Minecraft Inventory Editor");
}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -163,7 +163,8 @@ void MainWindow::closeEvent(QCloseEvent* event)

void MainWindow::Open()
{
QString fileName = QFileDialog::getOpenFileName(this,tr("Open NBT"));
const string savesDirectory = FilePath::GetMinecraftSavesDirectory();
QString fileName = QFileDialog::getOpenFileName(this,tr("Open NBT (Look for level.dat)"),savesDirectory.c_str());
if(fileName.isNull())
return;

Expand Down
2 changes: 1 addition & 1 deletion README
@@ -1,4 +1,4 @@
InvGrid 0.8.1
InvGrid 0.8.2

InvGrid is a simple inventory editor for Minecraft. It is designed to be cross platform compatible, unlike some other editors that require mono on Linux and OS X. Only Alpha and Beta based maps are currently supported.

Expand Down
1 change: 1 addition & 0 deletions invgrid.desktop
@@ -1,4 +1,5 @@
[Desktop Entry]
Encoding=UTF-8
Name=InvGrid
Comment=Simple Minecraft Alpha inventory editor.
Exec=InvGrid
Expand Down

0 comments on commit 39a121a

Please sign in to comment.