Hacks for dealing with negative item IDs...

This commit is contained in:
Dylan K. Taylor
2018-09-23 14:14:58 +01:00
parent 9d2e9e1663
commit ed1c511c3c
3 changed files with 20 additions and 7 deletions

View File

@ -111,7 +111,13 @@ class Block extends Position implements BlockIds, Metadatable{
* @return int
*/
public function getItemId() : int{
return $this->itemId ?? $this->getId();
if($this->itemId !== null){
return $this->itemId;
}
if($this->id > 255){
return 255 - $this->id;
}
return $this->id;
}
/**

View File

@ -61,14 +61,14 @@ class BlockFactory{
* this if you need to reset the block factory back to its original defaults for whatever reason.
*/
public static function init() : void{
self::$fullList = new \SplFixedArray(4096);
self::$getInterceptors = new \SplFixedArray(4096);
self::$fullList = new \SplFixedArray(8192);
self::$getInterceptors = new \SplFixedArray(8192);
self::$lightFilter = \SplFixedArray::fromArray(array_fill(0, 256, 1));
self::$diffusesSkyLight = \SplFixedArray::fromArray(array_fill(0, 256, false));
self::$blastResistance = \SplFixedArray::fromArray(array_fill(0, 256, 0));
self::$lightFilter = \SplFixedArray::fromArray(array_fill(0, 512, 1));
self::$diffusesSkyLight = \SplFixedArray::fromArray(array_fill(0, 512, false));
self::$blastResistance = \SplFixedArray::fromArray(array_fill(0, 512, 0));
self::$stateMasks = \SplFixedArray::fromArray(array_fill(0, 256, 0));
self::$stateMasks = \SplFixedArray::fromArray(array_fill(0, 512, 0));
self::registerBlock(new Air());