diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index fec5f9df..9e53682d 100755 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -3,7 +3,6 @@ class BlockAPI{ public static $creative = [ - //Building [STONE, 0], [COBBLESTONE, 0], @@ -165,6 +164,7 @@ class BlockAPI{ [CARPET, 10], [CARPET, 9], [CARPET, 8], + [END_PORTAL_FRAME, 0], //Tools [RAIL, 0], diff --git a/src/constants/BiomeIDs.php b/src/constants/BiomeIDs.php new file mode 100644 index 00000000..6988866e --- /dev/null +++ b/src/constants/BiomeIDs.php @@ -0,0 +1,43 @@ + "HardenedClayBlock", LOG2 => "Log2Block", LEAVES2 => "Leaves2Block", + END_PORTAL_FRAME => "EndPortalFrameBlock", ); protected $id; protected $meta; diff --git a/src/material/block/nonfull/CarpetBlock.php b/src/material/block/nonfull/CarpetBlock.php index ed1903aa..99e6237a 100644 --- a/src/material/block/nonfull/CarpetBlock.php +++ b/src/material/block/nonfull/CarpetBlock.php @@ -21,7 +21,7 @@ class CarpetBlock extends FlowableBlock{ 14 => "Red Carpet", 15 => "Black Carpet", ); - $this->name = $names[$this->meta]; + $this->name = $names[$this->meta & 0x15]; $this->hardness = 0; $this->isFullBlock = false; $this->isSolid = true; diff --git a/src/material/block/nonfull/EndPortalFrame.php b/src/material/block/nonfull/EndPortalFrame.php new file mode 100644 index 00000000..fe58e999 --- /dev/null +++ b/src/material/block/nonfull/EndPortalFrame.php @@ -0,0 +1,10 @@ +isFullBlock = false; + $this->hardness = 3600000; + //direction is isset in this version? + } +} \ No newline at end of file diff --git a/src/material/block/nonfull/FarmlandBlock.php b/src/material/block/nonfull/FarmlandBlock.php index e8fd2a57..fed4b3d0 100644 --- a/src/material/block/nonfull/FarmlandBlock.php +++ b/src/material/block/nonfull/FarmlandBlock.php @@ -5,16 +5,19 @@ class FarmlandBlock extends TransparentBlock{ parent::__construct(FARMLAND, $meta, "Farmland"); $this->hardness = 3; } + public function getDrops(Item $item, Player $player){ - return array( - array(DIRT, 0, 1), - ); + return [ + [DIRT, 0, 1] + ]; } + public function hasCrops(){ //TODO vanilla 0.8.1 detection method $b = $this->getSide(1); return $b->isTransparent && $b->id != 0; } + public function onUpdate($type){ if($type === BLOCK_UPDATE_NORMAL){ if(!$this->getSide(1)->isTransparent){ @@ -41,10 +44,9 @@ class FarmlandBlock extends TransparentBlock{ public function getBlockID($x, $y, $z){ return $this->level->level->getBlockID($x, $y, $z); //PMFLevel method -} + } public function checkWater(){ - for($x = $this->x - 4; $x <= $this->x + 4; $x++){ for($y = $this->y; $y <= $this->y + 1; $y++){ for($z = $this->z - 4; $z <= $this->z + 4; $z++){ @@ -56,6 +58,5 @@ class FarmlandBlock extends TransparentBlock{ } } return false; - } } diff --git a/src/material/block/nonfull/FenceBlock.php b/src/material/block/nonfull/FenceBlock.php index 9b4b0e91..50e1d6cc 100644 --- a/src/material/block/nonfull/FenceBlock.php +++ b/src/material/block/nonfull/FenceBlock.php @@ -6,7 +6,4 @@ class FenceBlock extends TransparentBlock{ $this->isFullBlock = false; $this->hardness = 15; } - - - } \ No newline at end of file diff --git a/src/material/block/nonfull/SlabBlock.php b/src/material/block/nonfull/SlabBlock.php index d8f3fba9..bd4d6d45 100644 --- a/src/material/block/nonfull/SlabBlock.php +++ b/src/material/block/nonfull/SlabBlock.php @@ -11,7 +11,7 @@ class SlabBlock extends TransparentBlock{ 4 => "Brick", 5 => "Stone Brick", 6 => "Quartz", - 7 => "", + 7 => "", //hum? ); $this->name = (($this->meta & 0x08) === 0x08 ? "Upper ":"") . $names[$this->meta & 0x07] . " Slab"; if(($this->meta & 0x08) === 0x08){ diff --git a/src/material/block/nonfull/WoodSlabBlock.php b/src/material/block/nonfull/WoodSlabBlock.php index 1b9a9dcc..53ebed4e 100644 --- a/src/material/block/nonfull/WoodSlabBlock.php +++ b/src/material/block/nonfull/WoodSlabBlock.php @@ -82,7 +82,7 @@ class WoodSlabBlock extends TransparentBlock{ public function getDrops(Item $item, Player $player){ return array( - array($this->id, $this->meta & 0x07, 1), + array($this->id, $this->meta & 0x07, 1), ); } } \ No newline at end of file diff --git a/src/material/block/plant/CyanFlowerBlock.php b/src/material/block/plant/CyanFlowerBlock.php index 29c17505..b9a74d43 100644 --- a/src/material/block/plant/CyanFlowerBlock.php +++ b/src/material/block/plant/CyanFlowerBlock.php @@ -13,7 +13,7 @@ class CyanFlowerBlock extends FlowableBlock{ 8 => "Oxeye Daisy", ]; public function __construct($meta = 0){ - parent::__construct(CYAN_FLOWER, $meta, nullsafe(self::$names[$meta], "Poppy")); + parent::__construct(CYAN_FLOWER, $meta, self::$names[$meta & 0x08]); $this->hardness = 0; } diff --git a/src/material/block/plant/TallGrassBlock.php b/src/material/block/plant/TallGrassBlock.php index 6c959713..082a79b3 100644 --- a/src/material/block/plant/TallGrassBlock.php +++ b/src/material/block/plant/TallGrassBlock.php @@ -9,7 +9,7 @@ class TallGrassBlock extends FlowableBlock{ 1 => "Tall Grass", 2 => "Fern", ); - $this->name = $names[$this->meta & 0x03]; + $this->name = $names[$this->meta & 0x02]; $this->hardness = 0; } diff --git a/src/material/block/solid/DirtBlock.php b/src/material/block/solid/DirtBlock.php index 67da228b..c5c37072 100644 --- a/src/material/block/solid/DirtBlock.php +++ b/src/material/block/solid/DirtBlock.php @@ -1,9 +1,14 @@ isActivable = true; + $names = array( + 0 => "Dirt", + 1 => "Grassless Dirt", + ); + $this->name = $names[$this->meta & 0x01]; $this->hardness = 2.5; } diff --git a/src/material/block/solid/Leaves2.php b/src/material/block/solid/Leaves2.php index 0f08531b..475feffe 100644 --- a/src/material/block/solid/Leaves2.php +++ b/src/material/block/solid/Leaves2.php @@ -8,7 +8,7 @@ class Leaves2Block extends TransparentBlock{ ]; public function __construct($meta = 0){ - parent::__construct(LEAVES2, $meta, nullsafe(self::$names[$meta & 0x03], "Leaves")); + parent::__construct(LEAVES2, $meta, self::$names[$meta & 0x01]); $this->hardness = 1; } diff --git a/src/material/block/solid/PlanksBlock.php b/src/material/block/solid/PlanksBlock.php index 0c539017..3bf0f9a0 100644 --- a/src/material/block/solid/PlanksBlock.php +++ b/src/material/block/solid/PlanksBlock.php @@ -11,7 +11,7 @@ class PlanksBlock extends SolidBlock{ 4 => "Acacia Wooden Planks", 5 => "Dark Oak Wooden Planks", ); - $this->name = $names[$this->meta]; + $this->name = $names[$this->meta & 0x05]; $this->hardness = 15; } diff --git a/src/material/block/solid/QuartzBlock.php b/src/material/block/solid/QuartzBlock.php index 4c1aaa5f..120272b5 100644 --- a/src/material/block/solid/QuartzBlock.php +++ b/src/material/block/solid/QuartzBlock.php @@ -7,7 +7,7 @@ class QuartzBlock extends SolidBlock{ 0 => "Quartz Block", 1 => "Chiseled Quartz Block", 2 => "Quartz Pillar", - 3 => "Quartz Pillar", + 3 => "Quartz Pillar", //why 2 pillars? ); $this->name = $names[$this->meta & 0x03]; } diff --git a/src/material/block/solid/SandBlock.php b/src/material/block/solid/SandBlock.php index 4ef43d81..c77b2798 100644 --- a/src/material/block/solid/SandBlock.php +++ b/src/material/block/solid/SandBlock.php @@ -7,7 +7,7 @@ class SandBlock extends FallableBlock{ 0 => "Sand", 1 => "Red Sand" ]; - $this->name = $names[$this->meta]; + $this->name = $names[$this->meta & 0x01]; $this->hardness = 2.5; } diff --git a/src/material/block/solid/StainedClayBlock.php b/src/material/block/solid/StainedClayBlock.php index 0b3ab0a5..a6855ad3 100644 --- a/src/material/block/solid/StainedClayBlock.php +++ b/src/material/block/solid/StainedClayBlock.php @@ -21,7 +21,7 @@ class StainedClayBlock extends SolidBlock{ 14 => "Red Stained Clay", 15 => "Black Stained Clay", ); - $this->name = $names[$this->meta & 0x03]; + $this->name = $names[$this->meta & 0x15]; $this->hardness = 30; } @@ -48,7 +48,7 @@ class StainedClayBlock extends SolidBlock{ public function getDrops(Item $item, Player $player){ if($item->getPickaxeLevel() >= 1){ return array( - array(STAINED_CLAY, $this->meta & 0x03, 1), + array(STAINED_CLAY, $this->meta & 0x15, 1) ); }else{ return array(); diff --git a/src/material/block/solid/StoneBlock.php b/src/material/block/solid/StoneBlock.php index 9bc89c2b..3553f8b4 100644 --- a/src/material/block/solid/StoneBlock.php +++ b/src/material/block/solid/StoneBlock.php @@ -12,7 +12,7 @@ class StoneBlock extends SolidBlock{ 5 => "Andesite", 6 => "Polished Andesite", ); - $this->name = $names[$this->meta]; + $this->name = $names[$this->meta & 0x06]; $this->hardness = 30; } diff --git a/src/material/block/solid/WoolBlock.php b/src/material/block/solid/WoolBlock.php index cd3d5377..075b03cf 100644 --- a/src/material/block/solid/WoolBlock.php +++ b/src/material/block/solid/WoolBlock.php @@ -21,7 +21,7 @@ class WoolBlock extends SolidBlock{ 14 => "Red Wool", 15 => "Black Wool", ); - $this->name = $names[$this->meta]; + $this->name = $names[$this->meta & 0x15]; $this->hardness = 4; } diff --git a/src/material/item/generic/BucketItem.php b/src/material/item/generic/BucketItem.php index 78feb784..c8cbff02 100644 --- a/src/material/item/generic/BucketItem.php +++ b/src/material/item/generic/BucketItem.php @@ -11,7 +11,7 @@ class BucketItem extends Item{ parent::__construct(BUCKET, $meta, $count, "Bucket"); $this->isActivable = true; $this->maxStackSize = 1; - $this->name = BucketItem::$possiblenames[$this->meta]; + $this->name = isset(BucketItem::$possiblenames[$this->meta]) ? BucketItem::$possiblenames[$this->meta] : "Bucket"; } public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ diff --git a/src/material/item/generic/DyeItem.php b/src/material/item/generic/DyeItem.php index 10ca822e..79a0bd1b 100755 --- a/src/material/item/generic/DyeItem.php +++ b/src/material/item/generic/DyeItem.php @@ -21,6 +21,6 @@ class DyeItem extends Item{ 14 => "Orange Dye", 15 => "Bone Meal", ); - $this->name = $names[$this->meta]; + $this->name = $names[$this->meta & 0x15]; } } \ No newline at end of file diff --git a/src/world/generator/SuperflatGenerator.php b/src/world/generator/SuperflatGenerator.php index bec529ed..59590690 100644 --- a/src/world/generator/SuperflatGenerator.php +++ b/src/world/generator/SuperflatGenerator.php @@ -25,11 +25,16 @@ class SuperflatGenerator implements LevelGenerator{ new OreType(new LapisOreBlock(), 1, 6, 0, 32), new OreType(new GoldOreBlock(), 2, 8, 0, 32), new OreType(new DiamondOreBlock(), 1, 7, 0, 16), + new OreType(new EmeraldOreBlock(), 1, 7, 0, 16), //TODO + new OreType(new DirtBlock(), 20, 32, 0, 128), new OreType(new GravelBlock(), 10, 16, 0, 128), - new OreType(new EmeraldOreBlock(), 1, 7, 0, 16), //TODO + new OreType(new StoneBlock(1), 20, 32, 0, 128), + new OreType(new StoneBlock(3), 20, 32, 0, 128), + new OreType(new StoneBlock(5), 20, 32, 0, 128), ]); $this->populators[] = $ores; + //$this->populators[] = new PondPopulator(); } /*if(isset($this->options["mineshaft"])){ diff --git a/src/world/generator/biome/Biome.php b/src/world/generator/biome/Biome.php new file mode 100644 index 00000000..82b8b0d2 --- /dev/null +++ b/src/world/generator/biome/Biome.php @@ -0,0 +1,8 @@ +setBlockRaw($pos, new WaterBlock()); } } \ No newline at end of file diff --git a/src/world/generator/object/grass/TallGrassObject.php b/src/world/generator/object/grass/TallGrassObject.php index 527a6373..3b494b2a 100644 --- a/src/world/generator/object/grass/TallGrassObject.php +++ b/src/world/generator/object/grass/TallGrassObject.php @@ -1,7 +1,7 @@