diff --git a/src/item/ItemComponentsTrait.php b/src/item/ItemComponentsTrait.php index ea03e31..d918b33 100644 --- a/src/item/ItemComponentsTrait.php +++ b/src/item/ItemComponentsTrait.php @@ -19,6 +19,7 @@ use customiesdevs\customies\item\component\MaxStackSizeComponent; use customiesdevs\customies\item\component\ProjectileComponent; use customiesdevs\customies\item\component\ThrowableComponent; +use customiesdevs\customies\item\component\UnbreakableComponent; use customiesdevs\customies\item\component\UseAnimationComponent; use customiesdevs\customies\item\component\UseDurationComponent; use customiesdevs\customies\item\component\WearableComponent; @@ -123,6 +124,10 @@ protected function initComponent(string $texture, ?CreativeInventoryInfo $creati $this->addComponent(new CanDestroyInCreativeComponent(false)); } } + + if($this instanceof Durable && $this->isUnbreakable()){ + $this->addComponent(new UnbreakableComponent(true)); + } } /** diff --git a/src/item/component/GlintComponent.php b/src/item/component/GlintComponent.php index 5a9b2c1..efe56ba 100644 --- a/src/item/component/GlintComponent.php +++ b/src/item/component/GlintComponent.php @@ -16,7 +16,7 @@ public function __construct(bool $glint = true) { } public function getName(): string { - return "foil"; + return "minecraft:glint"; } public function getValue(): bool { diff --git a/src/item/component/RecordComponent.php b/src/item/component/RecordComponent.php index 70cc327..9dc06b8 100644 --- a/src/item/component/RecordComponent.php +++ b/src/item/component/RecordComponent.php @@ -15,7 +15,7 @@ final class RecordComponent implements ItemComponent { * @param float $duration Specifies duration of sound event in seconds, float value * @param string $soundEvent Sound event type: 13, cat, blocks, chirp, far, mall, mellohi, stal, strad, ward, 11, wait, pigstep, otherside, 5, relic */ - public function __construct(int $comparatorSignal = 1, float $duration, string $soundEvent = "undefined") { + public function __construct(float $duration, int $comparatorSignal = 1, string $soundEvent = "undefined") { $this->comparatorSignal = $comparatorSignal; $this->duration = $duration; $this->soundEvent = $soundEvent; diff --git a/src/item/component/UnbreakableComponent.php b/src/item/component/UnbreakableComponent.php new file mode 100644 index 0000000..ecef5be --- /dev/null +++ b/src/item/component/UnbreakableComponent.php @@ -0,0 +1,30 @@ +unbreakable = $unbreakable; + } + + public function getName(): string { + return "minecraft:unbreakable"; + } + + public function getValue(): bool { + return $this->unbreakable; + } + + public function isProperty(): bool { + return true; + } + +} \ No newline at end of file