From 8d7d095bcb57abf790ede1dd1fe9a5172050c5c6 Mon Sep 17 00:00:00 2001 From: khIbrahim Date: Wed, 16 Jul 2025 19:06:58 +0100 Subject: [PATCH 1/3] Fix GlintComponent name and reorder RecordComponent constructor --- src/item/component/GlintComponent.php | 2 +- src/item/component/RecordComponent.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; From 79a597f21aa35e5cb4f445a927dc5eeef9d5bca3 Mon Sep 17 00:00:00 2001 From: khIbrahim Date: Sat, 19 Jul 2025 16:57:21 +0100 Subject: [PATCH 2/3] add unbreakable component --- src/item/ItemComponentsTrait.php | 5 ++++ src/item/component/UnbreakableComponent.php | 30 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/item/component/UnbreakableComponent.php diff --git a/src/item/ItemComponentsTrait.php b/src/item/ItemComponentsTrait.php index ea03e31..0854ed3 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->isUnbreakable()){ + $this->addComponent(new UnbreakableComponent(true)); + } } /** 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 From 9145a3bab6a04fe28f05629ffbddaa59222b82ed Mon Sep 17 00:00:00 2001 From: khIbrahim Date: Sat, 19 Jul 2025 17:49:10 +0100 Subject: [PATCH 3/3] fix --- src/item/ItemComponentsTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/item/ItemComponentsTrait.php b/src/item/ItemComponentsTrait.php index 0854ed3..d918b33 100644 --- a/src/item/ItemComponentsTrait.php +++ b/src/item/ItemComponentsTrait.php @@ -125,7 +125,7 @@ protected function initComponent(string $texture, ?CreativeInventoryInfo $creati } } - if($this->isUnbreakable()){ + if($this instanceof Durable && $this->isUnbreakable()){ $this->addComponent(new UnbreakableComponent(true)); } }