This commit is contained in:
GameHerobrine 2023-12-19 22:34:04 +03:00
parent 6d430c3440
commit b84093e4ce
25 changed files with 48 additions and 163 deletions

View file

@ -26,7 +26,7 @@ class LiquidBlock extends TransparentBlock{
return array();
}
public function getLiquidHeight(){ //TODO lava,water meta
public function getLiquidHeight(){
return (($this->meta >= 8 ? 0 : $this->meta)+1) / 9;
}
}

View file

@ -58,12 +58,11 @@ class NetherReactorBlock extends SolidBlock{
}
private function decay($x, $y, $z, $aOne, $aTwo, $aThree, $bOne, $bTwo, $bThree, $cOne, $cTwo, $cThree) {
for($a = $aOne; $a < $aTwo; $a += $aThree) { //wth those cycles are? TODO simplify if possible(makes server lag)
for($a = $aOne; $a < $aTwo; $a += $aThree) {
for($b = $bOne; $b < $bTwo; $b += $bThree) {
for($c = $cOne; $c < $cTwo; $c += $cThree) {
if ($this->level->level->getBlockID($x+$a, $y+$b, $z+$c) === NETHERRACK && lcg_value() > 0.75){
//$this->level->setBlock(new Vector3($x+$a, $y+$b, $z+$c), new AirBlock());
$this->level->fastSetBlockUpdate($x+$a, $y+$b, $z+$c, 0, 0); //TODO might be better to set not directly?
$this->level->fastSetBlockUpdate($x+$a, $y+$b, $z+$c, 0, 0);
}
}
}
@ -192,7 +191,7 @@ class NetherReactorBlock extends SolidBlock{
$b = $this->level->level->getBlockID($x + $offsetX, $y + $yOffset, $z + $offsetZ);
switch($char){
case "G":
if($b === GOLD_BLOCK){ //TODO make it use structure class
if($b === GOLD_BLOCK){
break;
}
return false;

View file

@ -1,19 +1,21 @@
<?php
class SlabBlock extends TransparentBlock{
public static $NAMES = [
0 => "Stone",
1 => "Sandstone",
2 => "Wooden",
3 => "Cobblestone",
4 => "Brick",
5 => "Stone Brick",
6 => "Quartz",
7 => "",
];
public function __construct($meta = 0){
parent::__construct(SLAB, $meta, "Slab");
$names = array( //TODO make it static
0 => "Stone",
1 => "Sandstone",
2 => "Wooden",
3 => "Cobblestone",
4 => "Brick",
5 => "Stone Brick",
6 => "Quartz",
7 => "",
);
$this->name = (($this->meta & 0x08) === 0x08 ? "Upper ":"") . $names[$this->meta & 0x07] . " Slab";
$this->name = (($this->meta & 0x08) === 0x08 ? "Upper ":"") . self::$NAMES[$this->meta & 0x07] . " Slab";
if(($this->meta & 0x08) === 0x08){
$this->isFullBlock = true;
}else{

View file

@ -68,7 +68,7 @@ class PaintingItem extends Item{
$validMotives[] = $motive;
}
}
$motive = $validMotives[array_rand($validMotives)]; //TODO simplify if possible
$motive = $validMotives[array_rand($validMotives)];
$data = array(
"x" => $target->x,
"y" => $target->y,

View file

@ -9,7 +9,7 @@ class FlintSteelItem extends ItemTool{
public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
if(($player->gamemode & 0x01) === 0 and $this->useOn($block) and $this->getMetadata() >= $this->getMaxDurability()){
$player->setSlot($player->slot, new Item(AIR, 0, 0), false); //TODO check
$player->setSlot($player->slot, new Item(AIR, 0, 0), false);
}
if($block->getID() === AIR and ($target instanceof SolidBlock)){
$level->setBlock($block, new FireBlock(), true, false, true);