-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconvert.php
More file actions
30 lines (25 loc) · 766 Bytes
/
convert.php
File metadata and controls
30 lines (25 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
if(!(PHP_VERSION_ID >= 50300)) {
die("PHP 5.3 or greater required\n");
}
require_once("nbt.class.php");
require_once("class.NBTInv.php");
require_once("class.MVInv.php");
require_once("class.ItemStack.php");
require_once("class.Materials.php");
require_once("class.Enchantments.php");
$nbt_file = $argv[1];
$json_file = $argv[2];
if(empty($nbt_file)) {
die("usage: {$argv[0]} player.dat output.json\n");
}
/* load and parse the nbt inventory data */
$nbtinv = new NBTInv();
$nbtinv->loadFile($nbt_file);
$inventory = $nbtinv->getInv();
$ender_inventory = $nbtinv->getEnderInv();
/* init Multiverse Inventory from the data above */
$mvinv = new MVInv();
$mvinv->loadInv($inventory);
$mvinv->loadEnderInv($ender_inventory);
$mvinv->writeJSON($json_file);