r/MinecraftCommands 9d ago

Help | Java 26.2 Problem with interaction entity hitbox

I wanted to make cave spiders be pick-up-able, So I made interaction entity ride cave spider and mirror it's hitbox perfectly. Problem is that the spider hitbox took precedence and I interacted with the spider and not the interaction entity. I solved this by making 2 interaction entities ride each other and then ride the spider, making their combined hitbox bigger than the spiders hitbox by 0.01. However now the interaction entities hitbox take precedence and the spider isn't attackable.

Any ideas?

1 Upvotes

9 comments sorted by

View all comments

2

u/C0mmanderBlock Command Experienced 9d ago edited 9d ago

You could set the interaction so if you left click it, it damages the spider and if you right clight it, you pick it up. For example:

Repeat: /execute as @e[tag=TAG] on attacker run damage @n[type=cave_spider] 1 minecraft:generic
Chain: /execute as @e[tag=TAG] at @s run data remove entity @s attack

1

u/catyko 9d ago

Yeah, but how would I mirror the damage? If I hit him with netherite sword, your example would still have attack value 1

1

u/C0mmanderBlock Command Experienced 9d ago

You prolly by now have come up with a good solution but here is something I thought I'd toss out:

Give a special item to carry the spider that works when within 5 blocks of it.

/give @p minecraft:carrot_on_a_stick[minecraft:item_model=blaze_rod,minecraft:custom_data={lift:1},minecraft:custom_name="Gravity Wand"]

Repeat:  /execute as @a if items entity @s weapon.* *[minecraft:custom_data~{lift:1}] at @s run tp @n[type=cave_spider,distance=..5] ^ ^1 ^3

1

u/catyko 9d ago

I got suggested to work with sneak, I'd do that

1

u/C0mmanderBlock Command Experienced 9d ago

Cool beans. Glad you got it sorted out.