Skip to content
This repository has been archived by the owner on Mar 12, 2021. It is now read-only.

Commit

Permalink
Fixed Nether issues
Browse files Browse the repository at this point in the history
Fix #20 and fix #18
  • Loading branch information
Xenophilicy committed Aug 26, 2020
1 parent 8134637 commit 45b6378
Show file tree
Hide file tree
Showing 105 changed files with 626 additions and 693 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
@@ -1,6 +1,6 @@
name: TableSpoon
main: Xenophilicy\TableSpoon\TableSpoon
version: 0.0.5-ALPHA
version: 0.0.6-ALPHA
api: 3.13.0
authors: [CortexPE, Xenophilicy, HyperFlareMC]
description: Adds cool features to PocketMine
Expand Down
4 changes: 1 addition & 3 deletions src/Xenophilicy/TableSpoon/EventListener.php
Expand Up @@ -91,7 +91,6 @@ public function onLevelLoad(LevelLoadEvent $ev){
}
}
}
return;
}

/**
Expand All @@ -113,7 +112,6 @@ public function onDamage(EntityDamageEvent $ev){
}
}
}
return;
}

/**
Expand Down Expand Up @@ -257,7 +255,7 @@ public function onDataPacketSend(DataPacketSendEvent $event): void{
$dimensionId = Utils::getDimension($world);
if($dimensionId === $packet->spawnSettings->getDimension()) return;
$event->setCancelled();
if($world === null) $target->sendDataPacket(clone $packet);
$target->sendDataPacket(clone $packet);
$pk = clone $packet;
$pk->spawnSettings = new SpawnSettings($packet->spawnSettings->getBiomeType(), $packet->spawnSettings->getBiomeName(), Utils::getDimension($world));
$target->sendDataPacket($pk);
Expand Down
2 changes: 1 addition & 1 deletion src/Xenophilicy/TableSpoon/block/Anvil.php
Expand Up @@ -14,7 +14,7 @@
* Class Anvil
* @package Xenophilicy\TableSpoon\block
*/
class Anvil extends PMAnvil{
class Anvil extends PMAnvil {
public function onActivate(Item $item, Player $player = null): bool{
if(TableSpoon::$settings["blocks"]["anvils"]){
if($player instanceof Player){
Expand Down
24 changes: 12 additions & 12 deletions src/Xenophilicy/TableSpoon/block/Beacon.php
Expand Up @@ -28,53 +28,53 @@
* Class Beacon
* @package Xenophilicy\TableSpoon\block
*/
class Beacon extends Transparent{

class Beacon extends Transparent {
/**
* @var int
*/
protected $id = self::BEACON;


/**
* @param int $meta Meta value of the block type
*/
public function __construct($meta = 0){
$this->meta = $meta;
}

/**
* @return bool
*/
public function canBeActivated(): bool{
return true;
}

/**
* @return string
*/
public function getName(): string{
return "Beacon";
}

/**
* @return int
*/
public function getLightLevel(): int{
return 15;
}

public function getBlastResistance(): float{
return 15;
}

/**
* @return float
*/
public function getHardness(): float{
return 3;
}

/**
* @param Item $item
* @param Block $blockReplace
Expand All @@ -90,7 +90,7 @@ public function place(Item $item, Block $blockReplace, Block $blockClicked, int
Tile::createTile(Tile::BEACON, $this->getLevel(), $nbt);
return true;
}

/**
* @param Item $item
* @param Player|null $player
Expand Down Expand Up @@ -120,7 +120,7 @@ public function onActivate(Item $item, Player $player = null): bool{
}
return true;
}

/**
* @param Item $item
* @param Player|null $player
Expand Down
4 changes: 2 additions & 2 deletions src/Xenophilicy/TableSpoon/block/Bed.php
Expand Up @@ -14,8 +14,8 @@
* Class Bed
* @package Xenophilicy\TableSpoon\block
*/
class Bed extends PMBed{

class Bed extends PMBed {
/**
* @param Item $item
* @param Player|null $player
Expand Down
2 changes: 1 addition & 1 deletion src/Xenophilicy/TableSpoon/block/BlockManager.php
Expand Up @@ -10,7 +10,7 @@
* Class BlockManager
* @package Xenophilicy\TableSpoon\block
*/
class BlockManager{
class BlockManager {
public static function init(): void{
BlockFactory::registerBlock(new Portal(), true);
BlockFactory::registerBlock(new EndPortal(), true);
Expand Down
8 changes: 4 additions & 4 deletions src/Xenophilicy/TableSpoon/block/BrewingStand.php
Expand Up @@ -19,7 +19,7 @@
* Class BrewingStand
* @package Xenophilicy\TableSpoon\block
*/
class BrewingStand extends PMBrewingStand{
class BrewingStand extends PMBrewingStand {
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null): bool{
$parent = parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
if(!$blockReplace->getSide(Vector3::SIDE_DOWN)->isTransparent()){
Expand All @@ -32,15 +32,15 @@ public function place(Item $item, Block $blockReplace, Block $blockClicked, int
}
return $parent;
}

public function getLightLevel(): int{
return 1;
}

public function getBlastResistance(): float{
return 2.5;
}

public function onActivate(Item $item, Player $player = null): bool{
if(!TableSpoon::$settings["blocks"]["brewing-stands"] || (TableSpoon::$settings["player"]["limited-creative"] && $player->isCreative())){
return true;
Expand Down
32 changes: 13 additions & 19 deletions src/Xenophilicy/TableSpoon/block/Cauldron.php
@@ -1,7 +1,6 @@
<?php

/**
*
* MMP""MM""YMM .M"""bgd
* P' MM `7 ,MI "Y
* MM .gP"Ya ,6"Yb. `MMb. `7MMpdMAo. ,pW"Wq. ,pW"Wq.`7MMpMMMb.
Expand All @@ -12,23 +11,18 @@
* MM
* .JMML.
* This file is part of TableSpoon.
*
* TableSpoon is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* TableSpoon is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with TableSpoon. If not, see <http://www.gnu.org/licenses/>.
*
* @author Xenophilicy\TableSpoon & iTX Technologies
* @link https://CortexPE.xyz
*
*/

declare(strict_types=1);
Expand Down Expand Up @@ -56,44 +50,44 @@
* Class Cauldron
* @package Xenophilicy\TableSpoon\block
*/
class Cauldron extends Transparent{

class Cauldron extends Transparent {
protected $id = self::CAULDRON_BLOCK;
protected $itemId = Item::CAULDRON;

/**
* Cauldron constructor.
* @param int $meta
*/
public function __construct($meta = 0){
$this->meta = $meta;
}

public function canBeActivated(): bool{
return true;
}

public function getName(): string{
return "Cauldron";
}

public function getHardness(): float{
return 2;
}

public function getToolType(): int{
return BlockToolType::TYPE_PICKAXE;
}

public function getToolHarvestLevel(): int{
return TieredTool::TIER_WOODEN;
}

public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null): bool{
Tile::createTile(Tile::CAULDRON, $this->getLevel(), CauldronTile::createNBT($this, $face, $item, $player));
return parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
}

public function onActivate(Item $item, Player $player = null): bool{
if(!TableSpoon::$settings["blocks"]["cauldrons"]){
return false;
Expand Down Expand Up @@ -188,7 +182,7 @@ public function onActivate(Item $item, Player $player = null): bool{
case Item::POTION:
case Item::SPLASH_POTION:
if(!$this->isEmpty() && ( // basically.... mismatched potion ID with cauldron = BOOM!
($tile->getPotionId() != $item->getDamage() && $item->getDamage() != 0) || ($item->getId() == Item::POTION && $tile->isSplashPotion()) || ($item->getId() == Item::SPLASH_POTION && !$tile->isSplashPotion()) && $item->getDamage() != 0 || ($item->getDamage() == 0 && $tile->hasPotion()))){
($tile->getPotionId() != $item->getDamage() && $item->getDamage() != 0) || ($item->getId() == Item::POTION && $tile->isSplashPotion()) || ($item->getId() == Item::SPLASH_POTION && !$tile->isSplashPotion()) && $item->getDamage() != 0 || ($item->getDamage() == 0 && $tile->hasPotion()))){
$this->meta = 0;
$tile->resetPotion();
$tile->setSplashPotion(false);
Expand Down Expand Up @@ -277,11 +271,11 @@ public function onActivate(Item $item, Player $player = null): bool{
$this->getLevel()->setBlock($this, $this, true);
return true;
}

public function isFull(): bool{
return $this->meta >= 6;
}

public function isEmpty(): bool{
return $this->meta == 0;
}
Expand Down
21 changes: 10 additions & 11 deletions src/Xenophilicy/TableSpoon/block/DragonEgg.php
Expand Up @@ -33,63 +33,62 @@
* Class DragonEgg
* @package Xenophilicy\TableSpoon\block
*/
class DragonEgg extends Fallable{

class DragonEgg extends Fallable {
/** @var int $id */
protected $id = self::DRAGON_EGG;

/**
* DragonEgg constructor.
*
* @param int $meta
*/
public function __construct($meta = 0){
$this->meta = $meta;
}

/**
* @return string
*/
public function getName(): string{
return "Dragon Egg";
}

/**
* @return float
*/
public function getHardness(): float{
return 4.5;
}

/**
* @return float
*/
public function getBlastResistance(): float{
return 45;
}

/**
* @return int
*/
public function getLightLevel(): int{
return 1;
}

/**
* @param Item $item
* @return bool
*/
public function isBreakable(Item $item): bool{
return false;
}

/**
* @return bool
*/
public function canBeActivated(): bool{
return true;
}

/**
* @param Item $item
* @param Player|null $player
Expand Down
6 changes: 3 additions & 3 deletions src/Xenophilicy/TableSpoon/block/EnchantingTable.php
Expand Up @@ -17,8 +17,8 @@
* Class EnchantingTable
* @package Xenophilicy\TableSpoon\block
*/
class EnchantingTable extends PMEnchantingTable{

class EnchantingTable extends PMEnchantingTable {
public function onActivate(Item $item, Player $player = null): bool{
if(TableSpoon::$settings["enchantments"]["enchantment-table"] && !(TableSpoon::$settings["player"]["limited-creative"] && $player->isCreative())){
if($player instanceof Player){
Expand All @@ -29,7 +29,7 @@ public function onActivate(Item $item, Player $player = null): bool{
}
return true;
}

public function countBookshelf(): int{
$count = 0;
$level = $this->getLevel();
Expand Down

0 comments on commit 45b6378

Please sign in to comment.