CustomiesDevs/Customies

no event call (break) when using a pickaxe

royaljacques opened this issue · 4 comments

I put you a small video, as well as my code

class SupraPickaxeTier1 extends Pickaxe implements ItemComponents
{
    use ItemComponentsTrait;

    protected int $xp = 0;
    protected int $level = 0;
    protected array $config = [
        0 => 2,
        1 => 3,
        2 => 4
    ];
    public function __construct(ItemIdentifier $identifier, string $name = 'supra_pickaxe'){
        parent::__construct($identifier, $name, ToolTier::DIAMOND());
        $cti = new CreativeInventoryInfo(CreativeInventoryInfo::CATEGORY_EQUIPMENT,CreativeInventoryInfo::GROUP_PICKAXE);
        $this->initComponent('supra_pickaxe', 1, $cti);
        $this->addProperty("minecraft:on_use", true);
        $this->addProperty("minecraft:on_use_on", true);
    }```
https://youtu.be/Z8dw--h2TMw

This is not how you're supposed to create a pickaxe, so I'm guessing the client is freaking out with it. Customies has no control over how events are called or whatever. Check out the minecraft:digger component and that should hopefully fix your issues

 $this->addComponent("minecraft:digger",
            CompoundTag::create()
                ->setTag("destroy_speeds", new ListTag([
                    "block" => CompoundTag::create()
                        ->setString("tags", new StringTag("query.any_tag('stone', 'metal', 'diamond_pick_diggable')"))
                        ->setInt("speed", 1)
                ]))
        ); ```

I tried that, but now I have the component problem. if someone knows what i should do or has an example i'm interested
 $this->addComponent("minecraft:digger",
            CompoundTag::create()
                ->setTag("destroy_speeds", new ListTag([
                    "block" => CompoundTag::create()
                        ->setString("tags", new StringTag("query.any_tag('stone', 'metal', 'diamond_pick_diggable')"))
                        ->setInt("speed", 1)
                ]))
        ); ```

I tried that, but now I have the component problem. if someone knows what i should do or has an example i'm interested
$blocks = new ListTag();
$blocks->push(CompoundTag::create()
  ->setTag('block', CompoundTag::create()
    ->setString('tags', "query.any_tag('stone', 'metal', 'diamond_pick_diggable')")
  )
  ->setInt("speed", 1)
);
$this->addComponent('minecraft:digger', CompoundTag::create()
  ->setByte("use_efficiency", true)
  ->setTag('destroy_speeds', $blocks)
);

Your problem is probably from the StringTag, you dont need to specify the class. Works just like setInt()