Skip to content
Open

Fixes #160

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ contributors:
- JackNoordhuis
- Unickorn
- abimek
- DrakzoSurYT # fix craft customies
- jujujustin69 # fix craft customies
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block;
namespace customiesdevs\customies\Blocks;

use customiesdevs\customies\block\component\BlockComponent;
use customiesdevs\customies\Blocks\Components\BlockComponent;

interface BlockComponents {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php

namespace customiesdevs\customies\block;
namespace customiesdevs\customies\Blocks;

use customiesdevs\customies\block\component\BlockComponent;
use customiesdevs\customies\block\component\BreathabilityComponent;
use customiesdevs\customies\block\component\CollisionBoxComponent;
use customiesdevs\customies\block\component\DestructibleByExplosionComponent;
use customiesdevs\customies\block\component\DestructibleByMiningComponent;
use customiesdevs\customies\block\component\DisplayNameComponent;
use customiesdevs\customies\block\component\FlammableComponent;
use customiesdevs\customies\block\component\FrictionComponent;
use customiesdevs\customies\block\component\GeometryComponent;
use customiesdevs\customies\block\component\LightDampeningComponent;
use customiesdevs\customies\block\component\LightEmissionComponent;
use customiesdevs\customies\block\component\MaterialInstancesComponent;
use customiesdevs\customies\block\component\SelectionBoxComponent;
use customiesdevs\customies\Blocks\Components\BlockComponent;
use customiesdevs\customies\Blocks\Components\BreathabilityComponent;
use customiesdevs\customies\Blocks\Components\CollisionBoxComponent;
use customiesdevs\customies\Blocks\Components\DestructibleByExplosionComponent;
use customiesdevs\customies\Blocks\Components\DestructibleByMiningComponent;
use customiesdevs\customies\Blocks\Components\DisplayNameComponent;
use customiesdevs\customies\Blocks\Components\FlammableComponent;
use customiesdevs\customies\Blocks\Components\FrictionComponent;
use customiesdevs\customies\Blocks\Components\GeometryComponent;
use customiesdevs\customies\Blocks\Components\LightDampeningComponent;
use customiesdevs\customies\Blocks\Components\LightEmissionComponent;
use customiesdevs\customies\Blocks\Components\MaterialInstancesComponent;
use customiesdevs\customies\Blocks\Components\SelectionBoxComponent;

trait BlockComponentsTrait {

Expand Down
2 changes: 1 addition & 1 deletion src/block/BlockPalette.php → src/Blocks/BlockPalette.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
declare(strict_types=1);

namespace customiesdevs\customies\block;
namespace customiesdevs\customies\Blocks;

use pocketmine\data\bedrock\block\BlockStateData;
use pocketmine\data\bedrock\block\BlockTypeNames;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
declare(strict_types=1);

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;

class BreathabilityComponent implements BlockComponent {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\math\Vector3;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\nbt\tag\ListTag;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;

class DestructibleByExplosionComponent implements BlockComponent {

Expand All @@ -22,6 +22,6 @@ public function getName(): string {

public function getValue(): CompoundTag {
return CompoundTag::create()
->setFloat("value", $this->explosionResistance);
->setFloat("explosion_resistance", $this->explosionResistance);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mojang can use both "value" & "explosion_resistance"
(In vanilla)

}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;

class DestructibleByMiningComponent implements BlockComponent {

Expand All @@ -22,6 +22,6 @@ public function getName(): string {

public function getValue(): CompoundTag {
return CompoundTag::create()
->setFloat("value", $this->secondsToDestroy);
->setFloat("seconds_to_destroy", $this->secondsToDestroy);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;

class DisplayNameComponent implements BlockComponent {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;

class FlammableComponent implements BlockComponent {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;

class FrictionComponent implements BlockComponent {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;

class GeometryComponent implements BlockComponent {

private string $geometry;
private CompoundTag $boneVisibility;

/**
* The description identifier of the geometry to use to render this block. This identifier must either match an existing geometry identifier in any of the loaded resource packs or be one of the currently supported Vanilla identifiers: "minecraft:geometry.full_block" or "minecraft:geometry.cross".
* The description identifier of the geometry to use to render this block. This identifier must either match an existing geometry identifier in any of the loaded resource packs or be one of the currently supported Vanillas identifiers: "minecraft:geometry.full_block" or "minecraft:geometry.cross".
* @param string $geometry
*/
public function __construct(string $geometry = "minecraft:geometry.full_block") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;

class LightDampeningComponent implements BlockComponent {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use pocketmine\nbt\tag\CompoundTag;
use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;

class LightEmissionComponent implements BlockComponent {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace customiesdevs\customies\block\component;
namespace customiesdevs\customies\Blocks\Components;

use customiesdevs\customies\block\Material;
use customiesdevs\customies\Blocks\Components\BlockComponent;use customiesdevs\customies\Blocks\Material;
use pocketmine\nbt\tag\CompoundTag;

class MaterialInstancesComponent implements BlockComponent {
Expand Down
46 changes: 46 additions & 0 deletions src/Blocks/Components/PickCollisionComponent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace customiesdevs\customies\Blocks\Components;

use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\nbt\tag\IntTag;
use pocketmine\nbt\tag\ListTag;

class PickCollisionComponent implements BlockComponent {

private array $origin;
private array $size;

/**
* Specifies the language file key that maps to what text will be displayed when you hover over the block in your inventory and hotbar.
* If the string given can not be resolved as a loc string, the raw string given will be displayed.
* If this component is omitted, the name of the block will be used as the display name.
* @param array $origin Example using String: `"Custom Block"`
* @param array $size Example using String: `"Custom Block"`
* Example using Localization String: `"block.customies:custom_block.name"`
*/
public function __construct(array $origin, array $size) {
$this->origin = $origin;
$this->size = $size;
}

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

public function getValue(): CompoundTag
{
return CompoundTag::create()
->setTag("origin", new ListTag([
new FloatTag($this->origin[0]),
new FloatTag($this->origin[1]),
new FloatTag($this->origin[2])
]))
->setTag("size", new ListTag([
new FloatTag($this->size[0]),
new FloatTag($this->size[1]),
new FloatTag($this->size[2])
]));
}
}
46 changes: 46 additions & 0 deletions src/Blocks/Components/SelectionBoxComponent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace customiesdevs\customies\Blocks\Components;

use customiesdevs\customies\Blocks\Components\BlockComponent;use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\FloatTag;
use pocketmine\nbt\tag\ListTag;

class SelectionBoxComponent implements BlockComponent {

private bool $useSelectionBox;
private Vector3 $origin;
private Vector3 $size;

/**
* Defines the area of the block that is selected by the player's cursor. If set to true, default values are used. If set to false, this block is not selectable by the player's cursor. If this component is omitted, default values are used.
* @param Vector3 $origin MMinimal position of the bounds of the selection box. "origin" is specified as [x, y, z] and must be in the range (-8, 0, -8) to (8, 16, 8), inclusive.
* @param Vector3 $size Size of each side of the selection box. Size is specified as [x, y, z]. "origin" + "size" must be in the range (-8, 0, -8) to (8, 16, 8), inclusive.
* @param bool $useSelectionBox If selection should be enabled, default is set to `true`.
*/
public function __construct(bool $useSelectionBox = true, ?Vector3 $origin = new Vector3(-8.0, 0.0, -8.0), ?Vector3 $size = new Vector3(16.0, 16.0, 16.0)) {
$this->useSelectionBox = $useSelectionBox;
$this->origin = $origin;
$this->size = $size;
}

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

public function getValue(): CompoundTag {
return CompoundTag::create()
->setByte("enabled", $this->useSelectionBox ? 1 : 0)
->setTag("origin", new ListTag([
new FloatTag($this->origin->getX()),
new FloatTag($this->origin->getY()),
new FloatTag($this->origin->getZ())
]))
->setTag("size", new ListTag([
new FloatTag($this->size->getX()),
new FloatTag($this->size->getY()),
new FloatTag($this->size->getZ())
]));
}
}
Loading