Skip to content
This repository has been archived by the owner on Jul 11, 2018. It is now read-only.

Commit

Permalink
Bug fixes, and doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroliu committed Apr 16, 2015
1 parent 57778db commit 268fc22
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 24 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ pmimporter
Overview
--------

* pmconvert - main conversion tool
* pmcheck - read world maps and analyze the block, object composition
* pmentities - dump entity information
* pmlevel - manipulate some level.dat settings
* convert - main conversion tool
* check - read world maps and analyze the block, object composition
* entities - dump entity information
* level - manipulate some level.dat settings
* nbtdump - Dump the contents of NBT files
* dumpchunk - Extract an specific chunk from a map so it can be
processed by nbtdump.
Expand Down Expand Up @@ -52,9 +52,9 @@ In general, the command usage is:

### Sub-commands

#### PMCONVERT
#### CONVERT

pmconvert [-c rules.txt ] [-t count] [-f format] srcpath dstpath
convert [-c rules.txt ] [-t count] [-f format] srcpath dstpath

Converts maps.

Expand All @@ -68,7 +68,7 @@ Converts maps.
* `srcpath` : Directory path to the source world.
* `dstpath` : Directory path to create the new world.

Also, `pmconvert` allows you to specify special settings to tweak the
Also, `convert` allows you to specify special settings to tweak the
format reader/writer code. These settings are specifc to each
`format`. To configure you must pass the option:

Expand All @@ -79,7 +79,7 @@ format reader/writer code. These settings are specifc to each

#### PMCHECK

pmcheck worldpath [--all|[rX,rZ[:cX,cZ[+cX,cZ]]] ...]
check worldpath [--all|[rX,rZ[:cX,cZ[+cX,cZ]]] ...]

Analyze the number of chunks, blocks, etc in a world map.

Expand All @@ -90,9 +90,9 @@ Analyze the number of chunks, blocks, etc in a world map.
31) to analyze.
* `+cX,cZ` : Additional chunks to add to totals.

#### PMLEVEL
#### LEVEL

pmlevel worldpath [attr=value]
level worldpath [attr=value]

Displays and modifies certain level attributes.

Expand Down Expand Up @@ -328,6 +328,8 @@ Changes

* 1.5: Bugfix
* BugFixes in MCPE0.2.0 format.
* BugFixes with region offsests on negative values
* Tweaked builds and subcommand names
* 1.4: Maintenance release
* pmentities fix typos
* minor text info tweaks
Expand Down
23 changes: 14 additions & 9 deletions build.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,25 @@
$p[$f] = file_get_contents($f);
}

$scripts= ["version","plugin","man"];

$help = "Available sub-commands:\n";
foreach (glob('scripts/*.php') as $f) {
$f = preg_replace('/^scripts\//','',$f);
foreach (glob('scripts/*.php') as $fp) {
$f = preg_replace('/^scripts\//','',$fp);
$f = preg_replace('/\.php$/','',$f);
$help .= "\t$f\n";
$f = preg_replace('/^pm/','',$f);
$scripts[] = $f;
echo "$fp as $f\n";
$p["scripts/$f.php"] = file_get_contents($fp);
}
$help .= "\tversion\n";
$help .= "\tplugin\n";
$help .= "\treadme\n";
$p['scripts/help.php'] = $help;
sort($scripts);
$p['scripts/help.php'] = "Available sub-commands:\n\t".
implode("\n\t",$scripts)."\n";

$p['scripts/version.php'] = "<?php require_once(CLASSLIB_DIR.'version.txt');";
$p['scripts/readme.php'] = file_get_contents('README.md');
$p['scripts/man.php'] = file_get_contents('README.md');

$dirs=['classlib','scripts'];
$dirs=['classlib'];
while(count($dirs)) {
$d = array_shift($dirs);
$dh = opendir($d) or die("$d: unable to open directory\n");
Expand Down
3 changes: 3 additions & 0 deletions classlib/pmimporter/blocks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
-149 UnpoweredComparator 0
-150 PoweredComparator 0
-151 DaylightDetector 0
; WILL BE AVAILABLE IN 0.11.0
-152 RedstoneBlock 89
-153 NetherQuartzOre 112
-154 Hopper 248
Expand Down Expand Up @@ -188,6 +189,8 @@
-180 RedSandstoneStairs 128
-181 DoubleRedSanstoneSlab 43
-182 RedSandstoneSlab 44
; For 0.11.0
;-198 GrassPath 171
243 Podzol
244 Beetroot
245 StoneCutter
Expand Down
1 change: 0 additions & 1 deletion classlib/pmimporter/generic/RegionLoader.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<?php
namespace pmimporter\generic;
use pmimporter\ImporterException;
Expand Down
20 changes: 19 additions & 1 deletion main.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,25 @@
die();
}

if (in_array($argv[0],array("version","plugin","readme","help"))) {
if ($argv[0] == "man") {
if (extension_loaded("posix")) {
if (posix_isatty(STDIN)) {
// Interactive... pipe through more
$fin = fopen("phar://pmimporter.phar/scripts/$argv[0].php","r");
$fout = popen("more","w");
if ($fin && $fout) {
stream_copy_to_stream($fin,$fout);
fclose($fin);
fclose($fout);
exit();
}
}
}
require_once("phar://pmimporter.phar/scripts/$argv[0].php");
exit;
}

if (in_array($argv[0],array("version","plugin","help"))) {
require_once("phar://pmimporter.phar/scripts/$argv[0].php");
require_once(CLASSLIB_DIR.'autoload.php');
exit;
Expand Down
2 changes: 0 additions & 2 deletions scripts/pmconvert.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
if (!$dstformat) die("Output format not recognized\n");
if ($dstformat !== McRegion::class) die("$dstformat: Format not supported\n");

print_r($settings);

$srcfmt = new $srcformat($srcpath,true,$settings["in"]);
$regions = $srcfmt->getRegions();
if (!count($regions)) die("No regions found in $srcpath\n");
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pmimporter 1.4rel
pmimporter 1.5pre

0 comments on commit 268fc22

Please sign in to comment.