diff --git a/builtin/minecraft/models/item/rc_firework_star_base.json b/builtin/minecraft/models/item/rc_firework_star_base.json new file mode 100644 index 0000000..1eecb1b --- /dev/null +++ b/builtin/minecraft/models/item/rc_firework_star_base.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "item/firework_star" + } +} diff --git a/builtin/minecraft/models/item/rc_firework_star_overlay.json b/builtin/minecraft/models/item/rc_firework_star_overlay.json new file mode 100644 index 0000000..b4c5a7e --- /dev/null +++ b/builtin/minecraft/models/item/rc_firework_star_overlay.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "item/firework_star_overlay" + } +} diff --git a/src/Output/ItemLibraryGenerator.php b/src/Output/ItemLibraryGenerator.php index 43c59c6..7d64213 100644 --- a/src/Output/ItemLibraryGenerator.php +++ b/src/Output/ItemLibraryGenerator.php @@ -10,6 +10,7 @@ use Aternos\Renderchest\Output\ItemStyle\DecoratedPotItemStyleGenerator; use Aternos\Renderchest\Output\ItemStyle\DefaultItemStyleGenerator; use Aternos\Renderchest\Output\ItemStyle\EnchantedItemStyleGenerator; +use Aternos\Renderchest\Output\ItemStyle\FireWorkStarItemStyleGenerator; use Aternos\Renderchest\Output\ItemStyle\InternalItemStyleGenerator; use Aternos\Renderchest\Output\ItemStyle\ItemStyleGenerator; use Aternos\Renderchest\Output\ItemStyle\MapItemStyleGenerator; @@ -33,6 +34,7 @@ class ItemLibraryGenerator PotionItemStyleGenerator::class, ChargedProjectileItemStyleGenerator::class, MapItemStyleGenerator::class, + FireWorkStarItemStyleGenerator::class, EnchantedItemStyleGenerator::class, DefaultItemStyleGenerator::class ]; diff --git a/src/Output/ItemStyle/FireWorkStarItemStyleGenerator.php b/src/Output/ItemStyle/FireWorkStarItemStyleGenerator.php new file mode 100644 index 0000000..a80f15c --- /dev/null +++ b/src/Output/ItemStyle/FireWorkStarItemStyleGenerator.php @@ -0,0 +1,70 @@ +getLocator() === "minecraft:firework_star"; + } + + /** + * @inheritDoc + */ + public static function getGlobalStyles(ItemLibraryGenerator $generator): array + { + return []; + } + + /** + * @param bool $fallback + * @return CSSEntry[] + */ + protected function getStyles(bool $fallback): array + { + $prefix = $this->item->getGenerator()->getPrefix(); + return [ + (new PropertyListEntry($this->getCssSelector())) + ->setProperties([ + "background-image" => $this->item->getGenerator()->getItemCSSUrl(static::BASE, $fallback), + "-webkit-mask-image" => $this->item->getGenerator()->getItemCSSUrl(static::MASK, $fallback), + "--" . $prefix . "layer-2-tint" => static::DEFAULT_COLOR + ]), + (new PropertyListEntry($this->getCssSelector() . ":before")) + ->setProperties([ + "background-image" => $this->item->getGenerator()->getItemCSSUrl(static::OVERLAY, $fallback), + "-webkit-mask-image" => $this->item->getGenerator()->getItemCSSUrl(static::OVERLAY, $fallback), + ]) + ]; + } + + /** + * @inheritDoc + */ + public function getItemStyles(): array + { + return $this->getStyles(false); + } + + /** + * @inheritDoc + */ + public function getItemFallbackStyles(): array + { + return $this->getStyles(true); + } +}