Added EndPortalFrame, fixed block names and added new stone blobs in flat

This commit is contained in:
ArkQuark 2023-02-24 17:06:11 +03:00
parent 612e09e0cc
commit 7255fbc3ad
40 changed files with 107 additions and 30 deletions

View file

@ -3,7 +3,6 @@
class BlockAPI{ class BlockAPI{
public static $creative = [ public static $creative = [
//Building //Building
[STONE, 0], [STONE, 0],
[COBBLESTONE, 0], [COBBLESTONE, 0],
@ -165,6 +164,7 @@ class BlockAPI{
[CARPET, 10], [CARPET, 10],
[CARPET, 9], [CARPET, 9],
[CARPET, 8], [CARPET, 8],
[END_PORTAL_FRAME, 0],
//Tools //Tools
[RAIL, 0], [RAIL, 0],

View file

@ -0,0 +1,43 @@
<?php
//0.9.5 adds 2 new biomes, ExtremeHills+ and JungleM(Modified Jungle)
define("OCEAN", 0);
define("PLAINS", 1);
define("DESERT", 2);
define("MOUNTAINS", 3); //extreme_hills
define("FOREST", 4);
define("TAIGA", 5);
define("SWAMP", 6);
define("RIVER", 7);
define("LEGACY_FROZEN_OCEAN", 10);
define("FROZEN_RIVER", 11);
define("ICE_PLAINS", 12);
define("MUSHROOM_ISLAND", 14);
define("MUSHROOM_ISLAND_SHORE", 15);
define("BEACH", 16);
define("DESERT_HILLS", 17);
define("SMALL_MOUNTAINS", 20);
define("JUNGLE", 21);
define("JUNGLE_HILLS", 22);
define("JUNGLE_ENGE", 23);
define("DEEP_OCEAN", 24);
define("BIRCH_FOREST", 27);
define("ROOFED_FOREST", 29);
define("SAVANNA", 35);
define("SAVANNA_PLATEAU", 36);
define("MESA", 37);
define("MESA_PLATEAU_STONE", 38);
define("SUNFLOWER_PLAINS", 129);
define("ICE_PLAINS_SPIKES", 140);
define("REDWOOD_TAIGA_MUTATED", 160);
define("MAX_BIOMES", 256);

View file

@ -10,6 +10,7 @@ define("ANDESITE", "1:5");
define("POLISHED_ANDESITE", "1:6"); define("POLISHED_ANDESITE", "1:6");
define("GRASS", 2); define("GRASS", 2);
define("DIRT", 3); define("DIRT", 3);
define("GRASSLESS_DIRT", "3:1");
define("COBBLESTONE", 4); define("COBBLESTONE", 4);
define("COBBLE", 4); define("COBBLE", 4);
define("PLANK", 5); define("PLANK", 5);
@ -83,8 +84,10 @@ define("RED_WOOL", "35:14");
define("BLACK_WOOL", "35:15"); define("BLACK_WOOL", "35:15");
define("DANDELION", 37); define("DANDELION", 37);
define("YELLOW_FLOWER", 37);
define("ROSE", 38); define("ROSE", 38);
define("CYAN_FLOWER", 38); //NO define("CYAN_FLOWER", 38); //NO
define("RED_FLOWER", 38);
define("BLUE_ORCHID", "38:1"); define("BLUE_ORCHID", "38:1");
define("ALLIUM", "38:2"); define("ALLIUM", "38:2");
define("AZURE_BLUET", "38:3"); define("AZURE_BLUET", "38:3");
@ -238,9 +241,10 @@ define("DARK_OAK_WOOD_STAIRS", 164);
define("HAY_BALE", 170); define("HAY_BALE", 170);
define("CARPET", 171); define("CARPET", 171);
//ANOTHER CARPET //ANOTHER CARPET
//DOUBLE FLOWERS
define("HARDENED_CLAY", 172); define("HARDENED_CLAY", 172);
define("COAL_BLOCK", 173); define("COAL_BLOCK", 173);
define("PACKED_ICE", 174);
define("DOUBLE_PLANT", 175);
define("PODZOL", 243); define("PODZOL", 243);
define("BEETROOT_BLOCK", 244); define("BEETROOT_BLOCK", 244);

View file

@ -141,6 +141,7 @@ abstract class Block extends Position{
HARDENED_CLAY => "HardenedClayBlock", HARDENED_CLAY => "HardenedClayBlock",
LOG2 => "Log2Block", LOG2 => "Log2Block",
LEAVES2 => "Leaves2Block", LEAVES2 => "Leaves2Block",
END_PORTAL_FRAME => "EndPortalFrameBlock",
); );
protected $id; protected $id;
protected $meta; protected $meta;

View file

@ -21,7 +21,7 @@ class CarpetBlock extends FlowableBlock{
14 => "Red Carpet", 14 => "Red Carpet",
15 => "Black Carpet", 15 => "Black Carpet",
); );
$this->name = $names[$this->meta]; $this->name = $names[$this->meta & 0x15];
$this->hardness = 0; $this->hardness = 0;
$this->isFullBlock = false; $this->isFullBlock = false;
$this->isSolid = true; $this->isSolid = true;

View file

@ -0,0 +1,10 @@
<?php
class EndPortalFrameBlock extends TransparentBlock{
public function __construct($meta = 0){
parent::__construct(END_PORTAL_FRAME, $meta, "End Portal Frame");
$this->isFullBlock = false;
$this->hardness = 3600000;
//direction is isset in this version?
}
}

View file

@ -5,16 +5,19 @@ class FarmlandBlock extends TransparentBlock{
parent::__construct(FARMLAND, $meta, "Farmland"); parent::__construct(FARMLAND, $meta, "Farmland");
$this->hardness = 3; $this->hardness = 3;
} }
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){
return array( return [
array(DIRT, 0, 1), [DIRT, 0, 1]
); ];
} }
public function hasCrops(){ public function hasCrops(){
//TODO vanilla 0.8.1 detection method //TODO vanilla 0.8.1 detection method
$b = $this->getSide(1); $b = $this->getSide(1);
return $b->isTransparent && $b->id != 0; return $b->isTransparent && $b->id != 0;
} }
public function onUpdate($type){ public function onUpdate($type){
if($type === BLOCK_UPDATE_NORMAL){ if($type === BLOCK_UPDATE_NORMAL){
if(!$this->getSide(1)->isTransparent){ if(!$this->getSide(1)->isTransparent){
@ -41,10 +44,9 @@ class FarmlandBlock extends TransparentBlock{
public function getBlockID($x, $y, $z){ public function getBlockID($x, $y, $z){
return $this->level->level->getBlockID($x, $y, $z); //PMFLevel method return $this->level->level->getBlockID($x, $y, $z); //PMFLevel method
} }
public function checkWater(){ public function checkWater(){
for($x = $this->x - 4; $x <= $this->x + 4; $x++){ for($x = $this->x - 4; $x <= $this->x + 4; $x++){
for($y = $this->y; $y <= $this->y + 1; $y++){ for($y = $this->y; $y <= $this->y + 1; $y++){
for($z = $this->z - 4; $z <= $this->z + 4; $z++){ for($z = $this->z - 4; $z <= $this->z + 4; $z++){
@ -56,6 +58,5 @@ class FarmlandBlock extends TransparentBlock{
} }
} }
return false; return false;
} }
} }

View file

@ -6,7 +6,4 @@ class FenceBlock extends TransparentBlock{
$this->isFullBlock = false; $this->isFullBlock = false;
$this->hardness = 15; $this->hardness = 15;
} }
} }

View file

@ -11,7 +11,7 @@ class SlabBlock extends TransparentBlock{
4 => "Brick", 4 => "Brick",
5 => "Stone Brick", 5 => "Stone Brick",
6 => "Quartz", 6 => "Quartz",
7 => "", 7 => "", //hum?
); );
$this->name = (($this->meta & 0x08) === 0x08 ? "Upper ":"") . $names[$this->meta & 0x07] . " Slab"; $this->name = (($this->meta & 0x08) === 0x08 ? "Upper ":"") . $names[$this->meta & 0x07] . " Slab";
if(($this->meta & 0x08) === 0x08){ if(($this->meta & 0x08) === 0x08){

View file

@ -82,7 +82,7 @@ class WoodSlabBlock extends TransparentBlock{
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){
return array( return array(
array($this->id, $this->meta & 0x07, 1), array($this->id, $this->meta & 0x07, 1),
); );
} }
} }

View file

@ -13,7 +13,7 @@ class CyanFlowerBlock extends FlowableBlock{
8 => "Oxeye Daisy", 8 => "Oxeye Daisy",
]; ];
public function __construct($meta = 0){ 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; $this->hardness = 0;
} }

View file

@ -9,7 +9,7 @@ class TallGrassBlock extends FlowableBlock{
1 => "Tall Grass", 1 => "Tall Grass",
2 => "Fern", 2 => "Fern",
); );
$this->name = $names[$this->meta & 0x03]; $this->name = $names[$this->meta & 0x02];
$this->hardness = 0; $this->hardness = 0;
} }

View file

@ -1,9 +1,14 @@
<?php <?php
class DirtBlock extends SolidBlock{ class DirtBlock extends SolidBlock{
public function __construct(){ public function __construct($meta = 0){
parent::__construct(DIRT, 0, "Dirt"); parent::__construct(DIRT, $meta, "Dirt");
$this->isActivable = true; $this->isActivable = true;
$names = array(
0 => "Dirt",
1 => "Grassless Dirt",
);
$this->name = $names[$this->meta & 0x01];
$this->hardness = 2.5; $this->hardness = 2.5;
} }

View file

@ -8,7 +8,7 @@ class Leaves2Block extends TransparentBlock{
]; ];
public function __construct($meta = 0){ 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; $this->hardness = 1;
} }

View file

@ -11,7 +11,7 @@ class PlanksBlock extends SolidBlock{
4 => "Acacia Wooden Planks", 4 => "Acacia Wooden Planks",
5 => "Dark Oak Wooden Planks", 5 => "Dark Oak Wooden Planks",
); );
$this->name = $names[$this->meta]; $this->name = $names[$this->meta & 0x05];
$this->hardness = 15; $this->hardness = 15;
} }

View file

@ -7,7 +7,7 @@ class QuartzBlock extends SolidBlock{
0 => "Quartz Block", 0 => "Quartz Block",
1 => "Chiseled Quartz Block", 1 => "Chiseled Quartz Block",
2 => "Quartz Pillar", 2 => "Quartz Pillar",
3 => "Quartz Pillar", 3 => "Quartz Pillar", //why 2 pillars?
); );
$this->name = $names[$this->meta & 0x03]; $this->name = $names[$this->meta & 0x03];
} }

View file

@ -7,7 +7,7 @@ class SandBlock extends FallableBlock{
0 => "Sand", 0 => "Sand",
1 => "Red Sand" 1 => "Red Sand"
]; ];
$this->name = $names[$this->meta]; $this->name = $names[$this->meta & 0x01];
$this->hardness = 2.5; $this->hardness = 2.5;
} }

View file

@ -21,7 +21,7 @@ class StainedClayBlock extends SolidBlock{
14 => "Red Stained Clay", 14 => "Red Stained Clay",
15 => "Black Stained Clay", 15 => "Black Stained Clay",
); );
$this->name = $names[$this->meta & 0x03]; $this->name = $names[$this->meta & 0x15];
$this->hardness = 30; $this->hardness = 30;
} }
@ -48,7 +48,7 @@ class StainedClayBlock extends SolidBlock{
public function getDrops(Item $item, Player $player){ public function getDrops(Item $item, Player $player){
if($item->getPickaxeLevel() >= 1){ if($item->getPickaxeLevel() >= 1){
return array( return array(
array(STAINED_CLAY, $this->meta & 0x03, 1), array(STAINED_CLAY, $this->meta & 0x15, 1)
); );
}else{ }else{
return array(); return array();

View file

@ -12,7 +12,7 @@ class StoneBlock extends SolidBlock{
5 => "Andesite", 5 => "Andesite",
6 => "Polished Andesite", 6 => "Polished Andesite",
); );
$this->name = $names[$this->meta]; $this->name = $names[$this->meta & 0x06];
$this->hardness = 30; $this->hardness = 30;
} }

View file

@ -21,7 +21,7 @@ class WoolBlock extends SolidBlock{
14 => "Red Wool", 14 => "Red Wool",
15 => "Black Wool", 15 => "Black Wool",
); );
$this->name = $names[$this->meta]; $this->name = $names[$this->meta & 0x15];
$this->hardness = 4; $this->hardness = 4;
} }

View file

@ -11,7 +11,7 @@ class BucketItem extends Item{
parent::__construct(BUCKET, $meta, $count, "Bucket"); parent::__construct(BUCKET, $meta, $count, "Bucket");
$this->isActivable = true; $this->isActivable = true;
$this->maxStackSize = 1; $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){ public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){

View file

@ -21,6 +21,6 @@ class DyeItem extends Item{
14 => "Orange Dye", 14 => "Orange Dye",
15 => "Bone Meal", 15 => "Bone Meal",
); );
$this->name = $names[$this->meta]; $this->name = $names[$this->meta & 0x15];
} }
} }

View file

@ -25,11 +25,16 @@ class SuperflatGenerator implements LevelGenerator{
new OreType(new LapisOreBlock(), 1, 6, 0, 32), new OreType(new LapisOreBlock(), 1, 6, 0, 32),
new OreType(new GoldOreBlock(), 2, 8, 0, 32), new OreType(new GoldOreBlock(), 2, 8, 0, 32),
new OreType(new DiamondOreBlock(), 1, 7, 0, 16), 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 DirtBlock(), 20, 32, 0, 128),
new OreType(new GravelBlock(), 10, 16, 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[] = $ores;
//$this->populators[] = new PondPopulator();
} }
/*if(isset($this->options["mineshaft"])){ /*if(isset($this->options["mineshaft"])){

View file

@ -0,0 +1,8 @@
<?php
abstract class Biome{
public static function init(){
//register biomes
}
}

View file

@ -11,8 +11,11 @@ class PondObject{
} }
public function canPlaceObject(Level $level, Vector3 $pos){ public function canPlaceObject(Level $level, Vector3 $pos){
//todo checking
return false;
} }
public function placeObject(Level $level, Vector3 $pos){ public function placeObject(Level $level, Vector3 $pos){
$level->setBlockRaw($pos, new WaterBlock());
} }
} }

View file

@ -1,7 +1,7 @@
<?php <?php
class TallGrassObject{ class TallGrassObject{
//checking biome
public static function growGrass(Level $level, Vector3 $pos, Random $random, $count = 15, $radius = 10){ public static function growGrass(Level $level, Vector3 $pos, Random $random, $count = 15, $radius = 10){
$arr = [ $arr = [
BlockAPI::get(DANDELION, 0), BlockAPI::get(DANDELION, 0),