Fixed chunk rotation on McRegion-based worlds

This commit is contained in:
Shoghi Cervantes 2014-08-01 11:52:13 +02:00
parent 171de939cd
commit 7c68e42a86
2 changed files with 30 additions and 18 deletions

View File

@ -78,15 +78,15 @@ class Chunk extends BaseFullChunk{
}
public function getBlockId($x, $y, $z){
return ord($this->blocks{($z << 11) + ($x << 7) + $y});
return ord($this->blocks{($x << 11) + ($z << 7) + $y});
}
public function setBlockId($x, $y, $z, $id){
$this->blocks{($z << 11) + ($x << 7) + $y} = chr($id);
$this->blocks{($x << 11) + ($z << 7) + $y} = chr($id);
}
public function getBlockData($x, $y, $z){
$m = ord($this->data{($z << 10) + ($x << 6) + ($y >> 1)});
$m = ord($this->data{($x << 10) + ($z << 6) + ($y >> 1)});
if(($y & 1) === 0){
return $m >> 4;
}else{
@ -95,7 +95,7 @@ class Chunk extends BaseFullChunk{
}
public function setBlockData($x, $y, $z, $data){
$i = ($z << 10) + ($x << 6) + ($y >> 1);
$i = ($x << 10) + ($z << 6) + ($y >> 1);
$old_m = ord($this->data{$i});
if(($y & 1) === 0){
$this->data{$i} = chr((($data & 0x0f) << 4) | ($old_m & 0x0f));
@ -105,7 +105,7 @@ class Chunk extends BaseFullChunk{
}
public function getBlock($x, $y, $z, &$blockId, &$meta = null){
$i = ($z << 11) + ($x << 7) + $y;
$i = ($x << 11) + ($z << 7) + $y;
$blockId = ord($this->blocks{$i});
$m = ord($this->data{$i >> 1});
if(($y & 1) === 0){
@ -116,7 +116,7 @@ class Chunk extends BaseFullChunk{
}
public function setBlock($x, $y, $z, $blockId = null, $meta = null){
$i = ($z << 11) + ($x << 7) + $y;
$i = ($x << 11) + ($z << 7) + $y;
$changed = false;
@ -148,7 +148,7 @@ class Chunk extends BaseFullChunk{
}
public function getBlockSkyLight($x, $y, $z){
$sl = ord($this->skyLight{($z << 10) + ($x << 6) + ($y >> 1)});
$sl = ord($this->skyLight{($x << 10) + ($z << 6) + ($y >> 1)});
if(($y & 1) === 0){
return $sl >> 4;
}else{
@ -157,7 +157,7 @@ class Chunk extends BaseFullChunk{
}
public function setBlockSkyLight($x, $y, $z, $level){
$i = ($z << 10) + ($x << 6) + ($y >> 1);
$i = ($x << 10) + ($z << 6) + ($y >> 1);
$old_sl = ord($this->skyLight{$i});
if(($y & 1) === 0){
$this->skyLight{$i} = chr((($level & 0x0f) << 4) | ($old_sl & 0x0f));
@ -167,7 +167,7 @@ class Chunk extends BaseFullChunk{
}
public function getBlockLight($x, $y, $z){
$l = ord($this->blockLight{($z << 10) + ($x << 6) + ($y >> 1)});
$l = ord($this->blockLight{($x << 10) + ($z << 6) + ($y >> 1)});
if(($y & 1) === 0){
return $l >> 4;
}else{
@ -176,7 +176,7 @@ class Chunk extends BaseFullChunk{
}
public function setBlockLight($x, $y, $z, $level){
$i = ($z << 10) + ($x << 6) + ($y >> 1);
$i = ($x << 10) + ($z << 6) + ($y >> 1);
$old_l = ord($this->blockLight{$i});
if(($y & 1) === 0){
$this->blockLight{$i} = chr((($level & 0x0f) << 4) | ($old_l & 0x0f));
@ -186,19 +186,19 @@ class Chunk extends BaseFullChunk{
}
public function getBlockIdColumn($x, $z){
return substr($this->blocks, ($z << 11) + ($x << 7), 128);
return substr($this->blocks, ($x << 11) + ($z << 7), 128);
}
public function getBlockDataColumn($x, $z){
return substr($this->data, ($z << 10) + ($x << 6), 64);
return substr($this->data, ($x << 10) + ($z << 6), 64);
}
public function getBlockSkyLightColumn($x, $z){
return substr($this->skyLight, ($z << 10) + ($x << 6), 64);
return substr($this->skyLight, ($x << 10) + ($z << 6), 64);
}
public function getBlockLightColumn($x, $z){
return substr($this->blockLight, ($z << 10) + ($x << 6), 64);
return substr($this->blockLight, ($x << 10) + ($z << 6), 64);
}
/**

View File

@ -4,12 +4,17 @@
settings:
shutdown-message: "Server closed"
#Allow listing plugins via Query
query-plugins: true
#Show a console message when a plugin uses deprecated API methods
deprecated-verbose: true
#Enable plugin and core profiling by default
enable-profiling: false
advanced-cache: false
upnp-forwarding: false
#Sends anonymous statistics to create usage reports
send-usage: true
#Number of AsyncTask workers
async-workers: 4
debug:
@ -19,15 +24,21 @@ debug:
commands: false
level-settings:
default-format: mcregion #The default format that levels will use when created
convert-format: false #If true, converts from a format that is not the default to the default format on load
#The default format that levels will use when created
default-format: mcregion
#If true, converts from a format that is not the default to the default format on load
convert-format: false
chunk-sending:
#Amount of chunks sent to players per tick
per-tick: 4
compression-level: 9
#Compression level used when sending chunks. Higher = more CPU, less bandwidth usage
compression-level: 7
chunk-ticking:
#Max amount of chunks processed each tick
per-tick: 80
#Radius of chunks around a player to tick
tick-radius: 2
light-updates: false
clear-tick-list: false
@ -47,7 +58,8 @@ spawn-limits:
water-animals: 5
ambient: 15
auto-report: #Send crash reports for processing
auto-report:
#Send crash reports for processing
enabled: true
send-code: true
send-settings: true