diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index efe21123..0cbeff32 100755 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -573,11 +573,7 @@ class BlockAPI{ public function nextRandomUpdate(Position $pos){ if(!isset($this->scheduledUpdates[$pos->x . "." . $pos->y . "." . $pos->z . "." . $pos->level->getName() . "." . BLOCK_UPDATE_RANDOM])){ - $X = (($pos->x >> 4) << 4); - $Y = (($pos->y >> 4) << 4); - $Z = (($pos->z >> 4) << 4); $time = microtime(true); - $i = 0; $offset = 0; while(true){ $t = $offset + Utils::getRandomUpdateTicks() * 0.05; diff --git a/src/API/ConsoleAPI.php b/src/API/ConsoleAPI.php index 3f0694c3..8aea33c5 100644 --- a/src/API/ConsoleAPI.php +++ b/src/API/ConsoleAPI.php @@ -51,7 +51,6 @@ class ConsoleAPI{ $this->loop->notify(); //@fclose($this->loop->fp); usleep(50000); - $this->loop->kill(); //$this->loop->join(); } } @@ -294,7 +293,6 @@ class ConsoleLoop extends Thread{ public $base; public $ev; public $fp; - public function __construct(){ $this->line = false; $this->stop = false; diff --git a/src/API/EntityAPI.php b/src/API/EntityAPI.php index f0f7d6f9..cdcff6ff 100644 --- a/src/API/EntityAPI.php +++ b/src/API/EntityAPI.php @@ -54,7 +54,7 @@ class EntityAPI{ } $mobName = ucfirst(array_flip($mob)[$type]); - if((strtolower($args[1] === "baby") or strtolower($args[2] === "baby")) and !Utils::in_range($type, 10, 13)){ + if((isset($args[1]) || isset($args[2])) && (strtolower($args[1] === "baby") or strtolower($args[2] === "baby")) and !Utils::in_range($type, 10, 13)){ $output .= "$mobName cannot be a baby!"; break; } diff --git a/src/API/PluginAPI.php b/src/API/PluginAPI.php index 2726a1dc..6cc65250 100644 --- a/src/API/PluginAPI.php +++ b/src/API/PluginAPI.php @@ -1,19 +1,5 @@ extraprops = new Config(DATA_PATH . "extra.properties", CONFIG_PROPERTIES, [ "version" => "5", - "experemental-mob-features" => false, - "enable-nether-reactor" => true, + "experemental-mob-features" => true, + "enable-mob-ai" => false, + "enable-nether-reactor" => true, "enable-explosions" => true, "enable-rail-connection" => false, "save-player-data" => true, @@ -82,6 +83,7 @@ class PocketMinecraftServer{ "discord-webhook-url" => "none", "discord-bot-name" => "NostalgiaCore Logger" ]); + Entity::$allowedAI = $this->extraprops->get("enable-mob-ai"); Entity::$updateOnTick = $this->extraprops->get("experemental-mob-features"); if(Entity::$updateOnTick){ console("[WARNING] Experemental mob features are enabled. Unpredictable behavior."); diff --git a/src/config.php b/src/config.php index efd25237..33b94ff4 100644 --- a/src/config.php +++ b/src/config.php @@ -48,7 +48,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH); ini_set("memory_limit", "256M"); //Default define("LOG", true); define("START_TIME", microtime(true)); -define("MAJOR_VERSION", "1.0.2dev (Alpha_1.3.12)"); +define("MAJOR_VERSION", "1.0.2dev"); define("CODENAME", "懐かしさ (Nostalgia)"); //i'm not very creative - kotyaralih define("CURRENT_MINECRAFT_VERSION", "v0.8.1 alpha"); define("CURRENT_API_VERSION", '12.1'); diff --git a/src/dependencies.php b/src/dependencies.php index 517001e9..c235f520 100644 --- a/src/dependencies.php +++ b/src/dependencies.php @@ -123,8 +123,16 @@ require_once(FILE_PATH . "/src/material/item/armor/ArmorItem.php"); require_once(FILE_PATH . "/src/structure/Structure.php"); +require_once(FILE_PATH . "/src/plugin/Plugin.php"); +require_once(FILE_PATH . "/src/plugin/OtherPluginRequirement.php"); +require_once(FILE_PATH . "/src/plugin/DummyPlugin.php"); +require_once(FILE_PATH . "/src/plugin/phar/IClassLoader.php"); +require_once(FILE_PATH . "/src/plugin/phar/PharUtils.php"); + require_all(FILE_PATH . "src/"); + + $inc = get_included_files(); $inc[] = array_shift($inc); $srcdir = realpath(FILE_PATH . "src/"); diff --git a/src/entity/Animal.php b/src/entity/Animal.php index d06d9209..a205b0b2 100644 --- a/src/entity/Animal.php +++ b/src/entity/Animal.php @@ -14,6 +14,7 @@ abstract class Animal extends Creature implements Ageable, Breedable{ if(isset($this->data["IsBaby"]) && $this->data["IsBaby"] && $this->getAge() >= 0){ $this->setAge(-24000); } + $this->ai->addTask(new TaskTempt()); } diff --git a/src/entity/Creature.php b/src/entity/Creature.php index b7ec2975..6c45076a 100644 --- a/src/entity/Creature.php +++ b/src/entity/Creature.php @@ -12,12 +12,11 @@ abstract class Creature extends Living{ $this->inPanic = false; //force for now parent::__construct($level, $eid, $class, $type, $data); $this->setHealth(isset($this->data["Health"]) ? $this->data["Health"] : 1, "generic"); - //$this->setName((isset($mobs[$this->type]) ? $mobs[$this->type]:$this->type)); - if(Entity::$updateOnTick){ - $this->ai->addTask(new TaskLookAround()); - $this->ai->addTask(new TaskRandomWalk()); - $this->ai->addTask(new TaskLookAtPlayer()); - } + // $this->setName((isset($mobs[$this->type]) ? $mobs[$this->type]:$this->type)); + $this->ai->addTask(new TaskLookAround()); + $this->ai->addTask(new TaskRandomWalk()); + $this->ai->addTask(new TaskLookAtPlayer()); + } diff --git a/src/entity/Entity.php b/src/entity/Entity.php index ba71dfa2..120f4137 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -6,7 +6,7 @@ class Entity extends Position const TYPE = - 1; const CLASS_TYPE = - 1; - public static $updateOnTick; + public static $updateOnTick, $allowedAI; public $isCollidable; public $canBeAttacked; public $moveTime, $lookTime, $idleTime; diff --git a/src/entity/Living.php b/src/entity/Living.php index ea63b266..59af9c63 100644 --- a/src/entity/Living.php +++ b/src/entity/Living.php @@ -27,7 +27,7 @@ abstract class Living extends Entity implements Damageable, Pathfindable{ } public function update(){ - if($this->idleTime <= 0) { + if(Entity::$allowedAI && $this->idleTime <= 0) { $this->ai->updateTasks(); } diff --git a/src/entity/registry/EntityList.php b/src/entity/registry/EntityList.php new file mode 100644 index 00000000..3d7caa05 --- /dev/null +++ b/src/entity/registry/EntityList.php @@ -0,0 +1,14 @@ +entities; + } + public function addEntity(PropertyEntity $property){ + $this->entities[$property->getEntityType()] = $property; + } + public function getEntityFromTypeAndClass($type, $class){ + return isset($this->entities[$type]) && $this->entities[$type]->getEntityClass() === $class ? $this->entities[$type] : 0; + } + private $entities = []; +} diff --git a/src/entity/EntityRegistry.php b/src/entity/registry/EntityRegistry.php similarity index 61% rename from src/entity/EntityRegistry.php rename to src/entity/registry/EntityRegistry.php index 7834b896..f8774378 100644 --- a/src/entity/EntityRegistry.php +++ b/src/entity/registry/EntityRegistry.php @@ -1,39 +1,6 @@ class = $class; - $this->type = $type; - $this->name = $name; - } - - public function getEntityClass(){ - return $this->class; - } - public function getEntityType(){ - return $this->type; - } - public function getEntityName(){ - return $this->name; - } -} - -class EntityList{ - public function getEntities(){ - return $this->entities; - } - public function addEntity(PropertyEntity $property){ - $this->entities[$property->getEntityType()] = $property; - } - public function getEntityFromTypeAndClass($type, $class){ - return isset($this->entities[$type]) && $this->entities[$type]->getEntityClass() === $class ? $this->entities[$type] : 0; - } - private $entities = []; -} - -class EntityRegistry{ +class EntityRegistry{ public static $entityList; /*Register all entities*/ public static function registerEntities(){ diff --git a/src/entity/registry/PropertyEntity.php b/src/entity/registry/PropertyEntity.php new file mode 100644 index 00000000..530b8080 --- /dev/null +++ b/src/entity/registry/PropertyEntity.php @@ -0,0 +1,21 @@ +class = $class; + $this->type = $type; + $this->name = $name; + } + + public function getEntityClass(){ + return $this->class; + } + public function getEntityType(){ + return $this->type; + } + public function getEntityName(){ + return $this->name; + } +} \ No newline at end of file diff --git a/src/material/block/attachable/Ladder.php b/src/material/block/attachable/LadderBlock.php similarity index 100% rename from src/material/block/attachable/Ladder.php rename to src/material/block/attachable/LadderBlock.php diff --git a/src/material/block/attachable/SignPost.php b/src/material/block/attachable/SignPostBlock.php similarity index 100% rename from src/material/block/attachable/SignPost.php rename to src/material/block/attachable/SignPostBlock.php diff --git a/src/material/block/attachable/Torch.php b/src/material/block/attachable/TorchBlock.php similarity index 100% rename from src/material/block/attachable/Torch.php rename to src/material/block/attachable/TorchBlock.php diff --git a/src/material/block/attachable/Trapdoor.php b/src/material/block/attachable/TrapdoorBlock.php similarity index 100% rename from src/material/block/attachable/Trapdoor.php rename to src/material/block/attachable/TrapdoorBlock.php diff --git a/src/material/block/attachable/WallSign.php b/src/material/block/attachable/WallSignBlock.php similarity index 87% rename from src/material/block/attachable/WallSign.php rename to src/material/block/attachable/WallSignBlock.php index 2f9846dc..b41f26a1 100644 --- a/src/material/block/attachable/WallSign.php +++ b/src/material/block/attachable/WallSignBlock.php @@ -1,7 +1,7 @@ level->getBlock(new Vector3($x+$a, $y+$b, $z+$c))->getID() === 87 && Utils::randomFloat() > 0.75){ @@ -188,24 +188,25 @@ class NetherReactorBlock extends SolidBlock{ foreach($this->core as $yOffset => $layer){ foreach($layer as $line){ foreach(str_split($line) as $char){ + $b = $this->level->getBlockWithoutVector(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ)); switch($char){ case "G": - if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === GOLD_BLOCK){ + if($b === GOLD_BLOCK){ //TODO make it use structure class break; } return false; case "C": - if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === COBBLESTONE){ + if($b === COBBLESTONE){ break; } return false; case "R": - if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === NETHER_REACTOR){ + if($b === NETHER_REACTOR){ break; } return false; case " ": - if($this->level->getBlock(new Vector3($x + $offsetX, $y + $yOffset, $z + $offsetZ))->getID() === 0){ + if($b->getID() === 0){ break; } return false; diff --git a/src/material/block/misc/TNT.php b/src/material/block/misc/TNTBlock.php similarity index 100% rename from src/material/block/misc/TNT.php rename to src/material/block/misc/TNTBlock.php diff --git a/src/material/block/nonfull/Cake.php b/src/material/block/nonfull/CakeBlock.php similarity index 100% rename from src/material/block/nonfull/Cake.php rename to src/material/block/nonfull/CakeBlock.php diff --git a/src/material/block/nonfull/Carpet.php b/src/material/block/nonfull/CarpetBlock.php similarity index 100% rename from src/material/block/nonfull/Carpet.php rename to src/material/block/nonfull/CarpetBlock.php diff --git a/src/material/block/nonfull/Chest.php b/src/material/block/nonfull/ChestBlock.php similarity index 100% rename from src/material/block/nonfull/Chest.php rename to src/material/block/nonfull/ChestBlock.php diff --git a/src/material/block/nonfull/Cobweb.php b/src/material/block/nonfull/CobwebBlock.php similarity index 100% rename from src/material/block/nonfull/Cobweb.php rename to src/material/block/nonfull/CobwebBlock.php diff --git a/src/material/block/nonfull/Farmland.php b/src/material/block/nonfull/FarmlandBlock.php similarity index 100% rename from src/material/block/nonfull/Farmland.php rename to src/material/block/nonfull/FarmlandBlock.php diff --git a/src/material/block/nonfull/Fence.php b/src/material/block/nonfull/FenceBlock.php similarity index 100% rename from src/material/block/nonfull/Fence.php rename to src/material/block/nonfull/FenceBlock.php diff --git a/src/material/block/nonfull/FenceGate.php b/src/material/block/nonfull/FenceGateBlock.php similarity index 100% rename from src/material/block/nonfull/FenceGate.php rename to src/material/block/nonfull/FenceGateBlock.php diff --git a/src/material/block/nonfull/GlassPane.php b/src/material/block/nonfull/GlassPaneBlock.php similarity index 100% rename from src/material/block/nonfull/GlassPane.php rename to src/material/block/nonfull/GlassPaneBlock.php diff --git a/src/material/block/nonfull/IronBars.php b/src/material/block/nonfull/IronBarsBlock.php similarity index 100% rename from src/material/block/nonfull/IronBars.php rename to src/material/block/nonfull/IronBarsBlock.php diff --git a/src/material/block/nonfull/IronDoor.php b/src/material/block/nonfull/IronDoorBlock.php similarity index 100% rename from src/material/block/nonfull/IronDoor.php rename to src/material/block/nonfull/IronDoorBlock.php diff --git a/src/material/block/nonfull/PoweredRail.php b/src/material/block/nonfull/PoweredRailBlock.php similarity index 100% rename from src/material/block/nonfull/PoweredRail.php rename to src/material/block/nonfull/PoweredRailBlock.php diff --git a/src/material/block/nonfull/Rail.php b/src/material/block/nonfull/RailBlock.php similarity index 99% rename from src/material/block/nonfull/Rail.php rename to src/material/block/nonfull/RailBlock.php index ca34b1bc..5afb2c71 100644 --- a/src/material/block/nonfull/Rail.php +++ b/src/material/block/nonfull/RailBlock.php @@ -30,7 +30,7 @@ class RailBlock extends FlowableBlock{ if(!($rail instanceof RailBlock)) return null; $damage = $rail->meta; if ($damage < 0 || $damage > 10) return null; - $delta = array( + $delta = array( //TODO make static array(array(0, 1), array(0, -1)), array(array(1, 0), array(-1, 0)), array(array(1, 0), array(-1, 0)), diff --git a/src/material/block/nonfull/Slab.php b/src/material/block/nonfull/SlabBlock.php similarity index 98% rename from src/material/block/nonfull/Slab.php rename to src/material/block/nonfull/SlabBlock.php index 31098656..d8f3fba9 100644 --- a/src/material/block/nonfull/Slab.php +++ b/src/material/block/nonfull/SlabBlock.php @@ -3,7 +3,7 @@ class SlabBlock extends TransparentBlock{ public function __construct($meta = 0){ parent::__construct(SLAB, $meta, "Slab"); - $names = array( + $names = array( //TODO make it static 0 => "Stone", 1 => "Sandstone", 2 => "Wooden", diff --git a/src/material/block/nonfull/SnowLayer.php b/src/material/block/nonfull/SnowLayerBlock.php similarity index 100% rename from src/material/block/nonfull/SnowLayer.php rename to src/material/block/nonfull/SnowLayerBlock.php diff --git a/src/material/block/nonfull/StoneWall.php b/src/material/block/nonfull/StoneWallBlock.php similarity index 100% rename from src/material/block/nonfull/StoneWall.php rename to src/material/block/nonfull/StoneWallBlock.php diff --git a/src/material/block/nonfull/WoodDoor.php b/src/material/block/nonfull/WoodDoorBlock.php similarity index 100% rename from src/material/block/nonfull/WoodDoor.php rename to src/material/block/nonfull/WoodDoorBlock.php diff --git a/src/material/block/nonfull/WoodSlab.php b/src/material/block/nonfull/WoodSlabBlock.php similarity index 100% rename from src/material/block/nonfull/WoodSlab.php rename to src/material/block/nonfull/WoodSlabBlock.php diff --git a/src/material/block/nonfull/stairs/BirchWoodStairs.php b/src/material/block/nonfull/stairs/BirchWoodStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/BirchWoodStairs.php rename to src/material/block/nonfull/stairs/BirchWoodStairsBlock.php diff --git a/src/material/block/nonfull/stairs/BrickStairs.php b/src/material/block/nonfull/stairs/BrickStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/BrickStairs.php rename to src/material/block/nonfull/stairs/BrickStairsBlock.php diff --git a/src/material/block/nonfull/stairs/CobblestoneStairs.php b/src/material/block/nonfull/stairs/CobblestoneStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/CobblestoneStairs.php rename to src/material/block/nonfull/stairs/CobblestoneStairsBlock.php diff --git a/src/material/block/nonfull/stairs/JungleWoodStairs.php b/src/material/block/nonfull/stairs/JungleWoodStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/JungleWoodStairs.php rename to src/material/block/nonfull/stairs/JungleWoodStairsBlock.php diff --git a/src/material/block/nonfull/stairs/NetherBricksStairs.php b/src/material/block/nonfull/stairs/NetherBricksStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/NetherBricksStairs.php rename to src/material/block/nonfull/stairs/NetherBricksStairsBlock.php diff --git a/src/material/block/nonfull/stairs/QuartzStairs.php b/src/material/block/nonfull/stairs/QuartzStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/QuartzStairs.php rename to src/material/block/nonfull/stairs/QuartzStairsBlock.php diff --git a/src/material/block/nonfull/stairs/SandstoneStairs.php b/src/material/block/nonfull/stairs/SandstoneStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/SandstoneStairs.php rename to src/material/block/nonfull/stairs/SandstoneStairsBlock.php diff --git a/src/material/block/nonfull/stairs/SpruceWoodStairs.php b/src/material/block/nonfull/stairs/SpruceWoodStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/SpruceWoodStairs.php rename to src/material/block/nonfull/stairs/SpruceWoodStairsBlock.php diff --git a/src/material/block/nonfull/stairs/StoneBrickStairs.php b/src/material/block/nonfull/stairs/StoneBrickStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/StoneBrickStairs.php rename to src/material/block/nonfull/stairs/StoneBrickStairsBlock.php diff --git a/src/material/block/nonfull/stairs/WoodStairs.php b/src/material/block/nonfull/stairs/WoodStairsBlock.php similarity index 100% rename from src/material/block/nonfull/stairs/WoodStairs.php rename to src/material/block/nonfull/stairs/WoodStairsBlock.php diff --git a/src/material/block/ore/CoalOre.php b/src/material/block/ore/CoalOreBlock.php similarity index 100% rename from src/material/block/ore/CoalOre.php rename to src/material/block/ore/CoalOreBlock.php diff --git a/src/material/block/ore/DiamondOre.php b/src/material/block/ore/DiamondOreBlock.php similarity index 100% rename from src/material/block/ore/DiamondOre.php rename to src/material/block/ore/DiamondOreBlock.php diff --git a/src/material/block/ore/GlowingRedstoneOre.php b/src/material/block/ore/GlowingRedstoneOreBlock.php similarity index 100% rename from src/material/block/ore/GlowingRedstoneOre.php rename to src/material/block/ore/GlowingRedstoneOreBlock.php diff --git a/src/material/block/ore/GoldOre.php b/src/material/block/ore/GoldOreBlock.php similarity index 100% rename from src/material/block/ore/GoldOre.php rename to src/material/block/ore/GoldOreBlock.php diff --git a/src/material/block/ore/IronOre.php b/src/material/block/ore/IronOreBlock.php similarity index 100% rename from src/material/block/ore/IronOre.php rename to src/material/block/ore/IronOreBlock.php diff --git a/src/material/block/ore/LapisOre.php b/src/material/block/ore/LapisOreBlock.php similarity index 100% rename from src/material/block/ore/LapisOre.php rename to src/material/block/ore/LapisOreBlock.php diff --git a/src/material/block/ore/RedstoneOre.php b/src/material/block/ore/RedstoneOreBlock.php similarity index 100% rename from src/material/block/ore/RedstoneOre.php rename to src/material/block/ore/RedstoneOreBlock.php diff --git a/src/material/block/plant/Beetroot.php b/src/material/block/plant/BeetrootBlock.php similarity index 100% rename from src/material/block/plant/Beetroot.php rename to src/material/block/plant/BeetrootBlock.php diff --git a/src/material/block/plant/BrownMushroom.php b/src/material/block/plant/BrownMushroomBlock.php similarity index 100% rename from src/material/block/plant/BrownMushroom.php rename to src/material/block/plant/BrownMushroomBlock.php diff --git a/src/material/block/plant/Cactus.php b/src/material/block/plant/CactusBlock.php similarity index 100% rename from src/material/block/plant/Cactus.php rename to src/material/block/plant/CactusBlock.php diff --git a/src/material/block/plant/Carrot.php b/src/material/block/plant/CarrotBlock.php similarity index 100% rename from src/material/block/plant/Carrot.php rename to src/material/block/plant/CarrotBlock.php diff --git a/src/material/block/plant/CyanFlower.php b/src/material/block/plant/CyanFlowerBlock.php similarity index 100% rename from src/material/block/plant/CyanFlower.php rename to src/material/block/plant/CyanFlowerBlock.php diff --git a/src/material/block/plant/Dandelion.php b/src/material/block/plant/DandelionBlock.php similarity index 100% rename from src/material/block/plant/Dandelion.php rename to src/material/block/plant/DandelionBlock.php diff --git a/src/material/block/plant/DeadBush.php b/src/material/block/plant/DeadBushBlock.php similarity index 100% rename from src/material/block/plant/DeadBush.php rename to src/material/block/plant/DeadBushBlock.php diff --git a/src/material/block/plant/MelonStem.php b/src/material/block/plant/MelonStemBlock.php similarity index 100% rename from src/material/block/plant/MelonStem.php rename to src/material/block/plant/MelonStemBlock.php diff --git a/src/material/block/plant/PumpkinStem.php b/src/material/block/plant/PumpkinStemBlock.php similarity index 100% rename from src/material/block/plant/PumpkinStem.php rename to src/material/block/plant/PumpkinStemBlock.php diff --git a/src/material/block/plant/RedMushroom.php b/src/material/block/plant/RedMushroomBlock.php similarity index 100% rename from src/material/block/plant/RedMushroom.php rename to src/material/block/plant/RedMushroomBlock.php diff --git a/src/material/block/plant/Sapling.php b/src/material/block/plant/SaplingBlock.php similarity index 100% rename from src/material/block/plant/Sapling.php rename to src/material/block/plant/SaplingBlock.php diff --git a/src/material/block/plant/Sugarcane.php b/src/material/block/plant/SugarcaneBlock.php similarity index 100% rename from src/material/block/plant/Sugarcane.php rename to src/material/block/plant/SugarcaneBlock.php diff --git a/src/material/block/plant/TallGrass.php b/src/material/block/plant/TallGrassBlock.php similarity index 100% rename from src/material/block/plant/TallGrass.php rename to src/material/block/plant/TallGrassBlock.php diff --git a/src/material/block/plant/Wheat.php b/src/material/block/plant/WheatBlock.php similarity index 100% rename from src/material/block/plant/Wheat.php rename to src/material/block/plant/WheatBlock.php diff --git a/src/material/block/solid/Bedrock.php b/src/material/block/solid/BedrockBlock.php similarity index 100% rename from src/material/block/solid/Bedrock.php rename to src/material/block/solid/BedrockBlock.php diff --git a/src/material/block/solid/Bookshelf.php b/src/material/block/solid/BookshelfBlock.php similarity index 100% rename from src/material/block/solid/Bookshelf.php rename to src/material/block/solid/BookshelfBlock.php diff --git a/src/material/block/solid/Bricks.php b/src/material/block/solid/BricksBlock.php similarity index 100% rename from src/material/block/solid/Bricks.php rename to src/material/block/solid/BricksBlock.php diff --git a/src/material/block/solid/BurningFurnace.php b/src/material/block/solid/BurningFurnaceBlock.php similarity index 100% rename from src/material/block/solid/BurningFurnace.php rename to src/material/block/solid/BurningFurnaceBlock.php diff --git a/src/material/block/solid/Clay.php b/src/material/block/solid/ClayBlock.php similarity index 100% rename from src/material/block/solid/Clay.php rename to src/material/block/solid/ClayBlock.php diff --git a/src/material/block/solid/Coal.php b/src/material/block/solid/CoalBlock.php similarity index 100% rename from src/material/block/solid/Coal.php rename to src/material/block/solid/CoalBlock.php diff --git a/src/material/block/solid/Cobblestone.php b/src/material/block/solid/CobblestoneBlock.php similarity index 100% rename from src/material/block/solid/Cobblestone.php rename to src/material/block/solid/CobblestoneBlock.php diff --git a/src/material/block/solid/Diamond.php b/src/material/block/solid/DiamondBlock.php similarity index 100% rename from src/material/block/solid/Diamond.php rename to src/material/block/solid/DiamondBlock.php diff --git a/src/material/block/solid/Dirt.php b/src/material/block/solid/DirtBlock.php similarity index 100% rename from src/material/block/solid/Dirt.php rename to src/material/block/solid/DirtBlock.php diff --git a/src/material/block/solid/DoubleSlab.php b/src/material/block/solid/DoubleSlabBlock.php similarity index 100% rename from src/material/block/solid/DoubleSlab.php rename to src/material/block/solid/DoubleSlabBlock.php diff --git a/src/material/block/solid/DoubleWoodSlab.php b/src/material/block/solid/DoubleWoodSlabBlock.php similarity index 100% rename from src/material/block/solid/DoubleWoodSlab.php rename to src/material/block/solid/DoubleWoodSlabBlock.php diff --git a/src/material/block/solid/Furnace.php b/src/material/block/solid/FurnaceBlock.php similarity index 85% rename from src/material/block/solid/Furnace.php rename to src/material/block/solid/FurnaceBlock.php index 08e59116..b4b6a535 100644 --- a/src/material/block/solid/Furnace.php +++ b/src/material/block/solid/FurnaceBlock.php @@ -1,7 +1,7 @@ $target->x, "y" => $target->y, diff --git a/src/material/item/generic/Paper.php b/src/material/item/generic/PaperItem.php similarity index 100% rename from src/material/item/generic/Paper.php rename to src/material/item/generic/PaperItem.php diff --git a/src/material/item/generic/PumpkinSeeds.php b/src/material/item/generic/PumpkinSeedsItem.php similarity index 100% rename from src/material/item/generic/PumpkinSeeds.php rename to src/material/item/generic/PumpkinSeedsItem.php diff --git a/src/material/item/generic/Quartz.php b/src/material/item/generic/QuartzItem.php similarity index 100% rename from src/material/item/generic/Quartz.php rename to src/material/item/generic/QuartzItem.php diff --git a/src/material/item/generic/Redstone.php b/src/material/item/generic/RedstoneItem.php similarity index 100% rename from src/material/item/generic/Redstone.php rename to src/material/item/generic/RedstoneItem.php diff --git a/src/material/item/generic/Saddle.php b/src/material/item/generic/SaddleItem.php similarity index 100% rename from src/material/item/generic/Saddle.php rename to src/material/item/generic/SaddleItem.php diff --git a/src/material/item/generic/Slimeball.php b/src/material/item/generic/SlimeballItem.php similarity index 100% rename from src/material/item/generic/Slimeball.php rename to src/material/item/generic/SlimeballItem.php diff --git a/src/material/item/generic/Snowball.php b/src/material/item/generic/SnowballItem.php similarity index 100% rename from src/material/item/generic/Snowball.php rename to src/material/item/generic/SnowballItem.php diff --git a/src/material/item/generic/SpawnEgg.php b/src/material/item/generic/SpawnEggItem.php similarity index 100% rename from src/material/item/generic/SpawnEgg.php rename to src/material/item/generic/SpawnEggItem.php diff --git a/src/material/item/generic/Stick.php b/src/material/item/generic/StickItem.php similarity index 100% rename from src/material/item/generic/Stick.php rename to src/material/item/generic/StickItem.php diff --git a/src/material/item/generic/Sugar.php b/src/material/item/generic/SugarItem.php similarity index 100% rename from src/material/item/generic/Sugar.php rename to src/material/item/generic/SugarItem.php diff --git a/src/material/item/generic/Sugarcane.php b/src/material/item/generic/SugarcaneItem.php similarity index 100% rename from src/material/item/generic/Sugarcane.php rename to src/material/item/generic/SugarcaneItem.php diff --git a/src/material/item/generic/Wheat.php b/src/material/item/generic/WheatItem.php similarity index 100% rename from src/material/item/generic/Wheat.php rename to src/material/item/generic/WheatItem.php diff --git a/src/material/item/generic/WheatSeeds.php b/src/material/item/generic/WheatSeedsItem.php similarity index 100% rename from src/material/item/generic/WheatSeeds.php rename to src/material/item/generic/WheatSeedsItem.php diff --git a/src/material/item/generic/WoodenDoor.php b/src/material/item/generic/WoodenDoorItem.php similarity index 100% rename from src/material/item/generic/WoodenDoor.php rename to src/material/item/generic/WoodenDoorItem.php diff --git a/src/material/item/tool/Bow.php b/src/material/item/tool/BowItem.php similarity index 100% rename from src/material/item/tool/Bow.php rename to src/material/item/tool/BowItem.php diff --git a/src/material/item/tool/Clock.php b/src/material/item/tool/ClockItem.php similarity index 100% rename from src/material/item/tool/Clock.php rename to src/material/item/tool/ClockItem.php diff --git a/src/material/item/tool/Compass.php b/src/material/item/tool/CompassItem.php similarity index 100% rename from src/material/item/tool/Compass.php rename to src/material/item/tool/CompassItem.php diff --git a/src/material/item/tool/DiamondAxe.php b/src/material/item/tool/DiamondAxeItem.php similarity index 100% rename from src/material/item/tool/DiamondAxe.php rename to src/material/item/tool/DiamondAxeItem.php diff --git a/src/material/item/tool/DiamondHoe.php b/src/material/item/tool/DiamondHoeItem.php similarity index 100% rename from src/material/item/tool/DiamondHoe.php rename to src/material/item/tool/DiamondHoeItem.php diff --git a/src/material/item/tool/DiamondPickaxe.php b/src/material/item/tool/DiamondPickaxeItem.php similarity index 100% rename from src/material/item/tool/DiamondPickaxe.php rename to src/material/item/tool/DiamondPickaxeItem.php diff --git a/src/material/item/tool/DiamondShovel.php b/src/material/item/tool/DiamondShovelItem.php similarity index 100% rename from src/material/item/tool/DiamondShovel.php rename to src/material/item/tool/DiamondShovelItem.php diff --git a/src/material/item/tool/DiamondSword.php b/src/material/item/tool/DiamondSwordItem.php similarity index 100% rename from src/material/item/tool/DiamondSword.php rename to src/material/item/tool/DiamondSwordItem.php diff --git a/src/material/item/tool/FlintSteel.php b/src/material/item/tool/FlintSteelItem.php similarity index 100% rename from src/material/item/tool/FlintSteel.php rename to src/material/item/tool/FlintSteelItem.php diff --git a/src/material/item/tool/GoldenAxe.php b/src/material/item/tool/GoldenAxeItem.php similarity index 100% rename from src/material/item/tool/GoldenAxe.php rename to src/material/item/tool/GoldenAxeItem.php diff --git a/src/material/item/tool/GoldenHoe.php b/src/material/item/tool/GoldenHoeItem.php similarity index 100% rename from src/material/item/tool/GoldenHoe.php rename to src/material/item/tool/GoldenHoeItem.php diff --git a/src/material/item/tool/GoldenPickaxe.php b/src/material/item/tool/GoldenPickaxeItem.php similarity index 100% rename from src/material/item/tool/GoldenPickaxe.php rename to src/material/item/tool/GoldenPickaxeItem.php diff --git a/src/material/item/tool/GoldenShovel.php b/src/material/item/tool/GoldenShovelItem.php similarity index 100% rename from src/material/item/tool/GoldenShovel.php rename to src/material/item/tool/GoldenShovelItem.php diff --git a/src/material/item/tool/GoldenSword.php b/src/material/item/tool/GoldenSwordItem.php similarity index 100% rename from src/material/item/tool/GoldenSword.php rename to src/material/item/tool/GoldenSwordItem.php diff --git a/src/material/item/tool/IronAxe.php b/src/material/item/tool/IronAxeItem.php similarity index 100% rename from src/material/item/tool/IronAxe.php rename to src/material/item/tool/IronAxeItem.php diff --git a/src/material/item/tool/IronHoe.php b/src/material/item/tool/IronHoeItem.php similarity index 100% rename from src/material/item/tool/IronHoe.php rename to src/material/item/tool/IronHoeItem.php diff --git a/src/material/item/tool/IronPickaxe.php b/src/material/item/tool/IronPickaxeItem.php similarity index 100% rename from src/material/item/tool/IronPickaxe.php rename to src/material/item/tool/IronPickaxeItem.php diff --git a/src/material/item/tool/IronShovel.php b/src/material/item/tool/IronShovelItem.php similarity index 100% rename from src/material/item/tool/IronShovel.php rename to src/material/item/tool/IronShovelItem.php diff --git a/src/material/item/tool/IronSword.php b/src/material/item/tool/IronSwordItem.php similarity index 100% rename from src/material/item/tool/IronSword.php rename to src/material/item/tool/IronSwordItem.php diff --git a/src/material/item/tool/Shears.php b/src/material/item/tool/ShearsItem.php similarity index 100% rename from src/material/item/tool/Shears.php rename to src/material/item/tool/ShearsItem.php diff --git a/src/material/item/tool/StoneAxe.php b/src/material/item/tool/StoneAxeItem.php similarity index 100% rename from src/material/item/tool/StoneAxe.php rename to src/material/item/tool/StoneAxeItem.php diff --git a/src/material/item/tool/StoneHoe.php b/src/material/item/tool/StoneHoeItem.php similarity index 100% rename from src/material/item/tool/StoneHoe.php rename to src/material/item/tool/StoneHoeItem.php diff --git a/src/material/item/tool/StonePickaxe.php b/src/material/item/tool/StonePickaxeItem.php similarity index 100% rename from src/material/item/tool/StonePickaxe.php rename to src/material/item/tool/StonePickaxeItem.php diff --git a/src/material/item/tool/StoneShovel.php b/src/material/item/tool/StoneShovelItem.php similarity index 100% rename from src/material/item/tool/StoneShovel.php rename to src/material/item/tool/StoneShovelItem.php diff --git a/src/material/item/tool/StoneSword.php b/src/material/item/tool/StoneSwordItem.php similarity index 100% rename from src/material/item/tool/StoneSword.php rename to src/material/item/tool/StoneSwordItem.php diff --git a/src/material/item/tool/WoodenAxe.php b/src/material/item/tool/WoodenAxeItem.php similarity index 100% rename from src/material/item/tool/WoodenAxe.php rename to src/material/item/tool/WoodenAxeItem.php diff --git a/src/material/item/tool/WoodenHoe.php b/src/material/item/tool/WoodenHoeItem.php similarity index 100% rename from src/material/item/tool/WoodenHoe.php rename to src/material/item/tool/WoodenHoeItem.php diff --git a/src/material/item/tool/WoodenPickaxe.php b/src/material/item/tool/WoodenPickaxeItem.php similarity index 100% rename from src/material/item/tool/WoodenPickaxe.php rename to src/material/item/tool/WoodenPickaxeItem.php diff --git a/src/material/item/tool/WoodenShovel.php b/src/material/item/tool/WoodenShovelItem.php similarity index 100% rename from src/material/item/tool/WoodenShovel.php rename to src/material/item/tool/WoodenShovelItem.php diff --git a/src/material/item/tool/WoodenSword.php b/src/material/item/tool/WoodenSwordItem.php similarity index 100% rename from src/material/item/tool/WoodenSword.php rename to src/material/item/tool/WoodenSwordItem.php diff --git a/src/plugin/DummyPlugin.php b/src/plugin/DummyPlugin.php new file mode 100644 index 00000000..da2cfbef --- /dev/null +++ b/src/plugin/DummyPlugin.php @@ -0,0 +1,13 @@ +chunks as $index => $chunk){ + foreach($this->chunks as $index => $chunk){ //TODO fix variables($X, $Z are undefined) $this->getXZ($index, $X, $Z); $this->saveChunk($X, $Z); } diff --git a/src/pmf/Plugin.php b/src/pmf/PMFPlugin.php similarity index 100% rename from src/pmf/Plugin.php rename to src/pmf/PMFPlugin.php diff --git a/src/utils/pthreads.php b/src/utils/AsyncMultipleQueue.php similarity index 100% rename from src/utils/pthreads.php rename to src/utils/AsyncMultipleQueue.php diff --git a/src/utils/Java.php b/src/utils/Java.php index 5f5fe667..267cb030 100644 --- a/src/utils/Java.php +++ b/src/utils/Java.php @@ -1,6 +1,6 @@ 0, - "a" => 0, - "beta" => 1, - "b" => 1, - "final" => 2, - "f" => 2, - ]; - private $stage; - private $major; - private $release; - private $minor; + private $development = false; public function __construct($version = MAJOR_VERSION){ - if(is_int($version)){ - $this->minor = $version & 0x1F; - $this->major = ($version >> 5) & 0x0F; - $this->generation = ($version >> 9) & 0x0F; - $this->stage = array_search(($version >> 13) & 0x0F, VersionString::$stageOrder, true); - }else{ - $version = preg_split("/([A-Za-z]*)[ _\-]([0-9]*)\.([0-9]*)\.{0,1}([0-9]*)(dev|)/", $version, -1, PREG_SPLIT_DELIM_CAPTURE); - $this->stage = strtolower($version[1]); //0-15 - $this->generation = (int) $version[2]; //0-15 - $this->major = (int) $version[3]; //0-15 - $this->minor = (int) $version[4]; //0-31 - $this->development = $version[5] === "dev" ? true : false; - } - } - - public function getStage(){ - return $this->stage; - } - - public function getGeneration(){ - return $this->generation; - } - - public function getMajor(){ - return $this->major; - } - - public function getMinor(){ - return $this->minor; + $this->development = Utils::endsWith($version, "dev"); } public function isDev(){ @@ -53,36 +13,6 @@ class VersionString{ } public function __toString(){ - return $this->get(); - } - - public function get(){ - return ucfirst($this->stage) . "_" . $this->getRelease() . ($this->development === true ? "dev" : ""); - } - - public function getRelease(){ - return $this->generation . "." . $this->major . "." . $this->minor; - } - - public function compare($target, $diff = false){ - if(($target instanceof VersionString) === false){ - $target = new VersionString($target); - } - $number = $this->getNumber(); - $tNumber = $target->getNumber(); - if($diff === true){ - return $tNumber - $number; - } - if($number > $tNumber){ - return -1; //Target is older - }elseif($number < $tNumber){ - return 1; //Target is newer - }else{ - return 0; //Same version - } - } - - public function getNumber(){ - return (int) (VersionString::$stageOrder[$this->stage] << 13) + ($this->generation << 9) + ($this->major << 5) + $this->minor; + return MAJOR_VERSION; } } \ No newline at end of file diff --git a/src/world/MocingObjectPosition.php b/src/world/MovingObjectPosition.php similarity index 100% rename from src/world/MocingObjectPosition.php rename to src/world/MovingObjectPosition.php diff --git a/src/world/generator/SuperflatGenerator.php b/src/world/generator/SuperflatGenerator.php index cf7ac2f1..8a317c43 100644 --- a/src/world/generator/SuperflatGenerator.php +++ b/src/world/generator/SuperflatGenerator.php @@ -35,7 +35,7 @@ class SuperflatGenerator implements LevelGenerator{ $this->populators[] = new MineshaftPopulator(isset($this->options["mineshaft"]["chance"]) ? floatval($this->options["mineshaft"]["chance"]) : 0.01); }*/ } - + public function parsePreset($preset){ $this->preset = $preset; $preset = explode(";", $preset);