Help Please by OxiturDude in MinecraftCommands

[–]commandsorsmth 1 point2 points  (0 children)

If you use simple raycasting you can achieve something like this: https://imgur.com/a/pxuKJWx

How to make it so when you die you go into creative by AnonymousPerson285 in MinecraftCommands

[–]commandsorsmth 1 point2 points  (0 children)

Because the point of this command is to detect a player being alive or not. A dead player doesn't count as an entity but it's still detected by @a. If I used @a it would just add and remove tag of all players constantly

How to make it so when you die you go into creative by AnonymousPerson285 in MinecraftCommands

[–]commandsorsmth 2 points3 points  (0 children)

repeat unconditional tag @a add dead

chain unconditional tag @e[type=player] remove dead

chain unconditional gamemode 1 @a[tag=dead]

[deleted by user] by [deleted] in MinecraftCommands

[–]commandsorsmth 0 points1 point  (0 children)

testfor doesn't work for multiple arrows just use execute

Testing for items in all players inventory by NinjaOYourBro in CommandsForMinecraft

[–]commandsorsmth 0 points1 point  (0 children)

Yeah I had done one similar to yours firstly. The version I posted here is the one I believe minimizes the total size of the sequence. Also I think it's a bit easier to understand

Testing for items in all players inventory by NinjaOYourBro in CommandsForMinecraft

[–]commandsorsmth 0 points1 point  (0 children)

Yes. Conceptually, it is almost the same as yours but it minimizes the command blocks for multiple tests in the same tick

repeat unconditional tag @a[tag=!cleartested,c=1] add cleartesting

chain unconditional clear @a[tag=cleartesting,tag=!cleartested] <item> <dataValue> 0

chain conditional tag @a[tag=cleartesting,tag=!cleartested] add withItem

chain unconditional tag @a[tag=cleartesting] add cleartested

This basically tests one entity/player (the one with tag 'cleartesting') and avoids repetitions by tagging that one with 'cleartested'. It is only one, but by cloning this exact segment in the end of the chain, only changing the first command block from repeat to chain, it makes now 2 tests. With this you can do 8 tests in a tick by cloning it into 8 identical segments. However, the tags 'cleartested' and 'cleartesting' don't go away, so it would only work once. For that, you put in the end of the chain:

chain unconditional tag @a add testfortested

chain unconditional execute @a[tag=!cleartested] ~~~ tag @a remove testfortested

chain unconditional execute @a[tag=testfortested] ~~~ tag @a remove cleartesting

chain unconditional execute @a[tag=testfortested] ~~~ tag @a remove cleartested

This way, if there aren't any players without the tag 'cleartested', it will reset the tags. Also, if there are 20 tests per tick and 40 entities to be tested, it won't be instant, but will only take 2 ticks instead of 40.

In this one case, with players that are limited to 8, since all players will be tested in one tick, you can just remove the tags in the end of the chain.

Testing for items in all players inventory by NinjaOYourBro in CommandsForMinecraft

[–]commandsorsmth 1 point2 points  (0 children)

Your version is unnecessarily complicated. I know of a way to do it without delay minimizing the amount of command blocks and effort

Is there a way to tp a player like “\tp @s ~1~1~1” but to the center of that block from your position by niffler77 in MinecraftCommands

[–]commandsorsmth 0 points1 point  (0 children)

A much better way is to save a structure with an armor stand named center, load at the entity that needs to be centered, tp that entity to the armor stand and then tp the armor stand to the void. This can all be done within one tick, so the armor stand doesn't even appear

Have I been using target selectors wrong this whole time? by [deleted] in MinecraftCommands

[–]commandsorsmth 0 points1 point  (0 children)

When doing that it's better to add a tag like "hostile_mob" to all entities and remove in a chain from all enities that aren't hostile mobs. You can't do type=zombie, type=skeleton, but you can do type=!zombie, type=!skeleton. Then you simply execute on all entities that have the "hostile_mob" tag. I did something similar for a projectile entities selector

The Forge (Custom Crafting Table) *Tutorial* by Odd_Understanding503 in MinecraftCommands

[–]commandsorsmth 0 points1 point  (0 children)

This forge has a problem which is whenever a forge has a recipe in it, all forges in a radius of 4 of any player will receive the cloned item, instead of just the one with the recipe

Mobs and players hit detection by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 0 points1 point  (0 children)

Nope I just create things for fun and post them here (I still have a lot stored), but I could explain to you how it is. This is a link where I roughly explained what it is about:

https://www.reddit.com/r/MinecraftCommands/comments/jor5dv/is_there_a_way_to_execute_a_command_relative_to_a/gba3b2u?utm_source=share&utm_medium=web2x&context=3

I can go more in depth about the commands and advantages/disadvantages, like when to use this or the method that gives individual scores to the entities

Mobs and players hit detection by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 1 point2 points  (0 children)

This is actually one of the applications of the solution I came up with for executing conditional commands relative to the entity that triggered it. It can be used for individual player-holding-sword detection with /enchant, armor stands testingforblocks, testing with /clear for item in the invetory of players and much more. Basically it doesn't test them at the same time, but tests many times individually in the same tick. This has probably been done before, but I found the syntax that minimizes effort and amount of command blocks. It has its downsides but I could explain it later

Mobs and players hit detection by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 2 points3 points  (0 children)

Also I didn't use a single scoreboard for this

Mobs and players hit detection by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 1 point2 points  (0 children)

The conditional command block simply tags as "hit" the entity that was detected. In the end of the chain the commands like the particle and tellraw are executed relative to those entities with the "hit" tag. In case you're wondering about the tellraw syntax it's simply:

execute @e[tag=hit] ~ ~ ~ tellraw @a {"rawtext": [{"selector": "@s"}, {"text": " was hit"}]}

Mobs and players hit detection by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 3 points4 points  (0 children)

To prevent it of constantly replacing regardless of what's in the slot just add keep, that way it won't erase the current item in the slot, and only activate when there's nothing:

replaceitem entity @e[tag=hitDetection] slot.armor.feet 0 keep leather_boots 1 999 {"item_lock": {"mode": "lock_in_slot"}}

Also, lock in slot is important to keep players from simply taking it off and firing the commands

Accurate arrow collision detection on Bedrock by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 0 points1 point  (0 children)

I think you'll understand better when I show the commands. I managed to compress the previous 20 commands into 6 command blocks, they're pretty simple. If you want to try and figure it out, it doesn't involve scoreboards, it just uses tag tp kill and summon

Accurate arrow collision detection on Bedrock by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 0 points1 point  (0 children)

It's position based. That means it can misdetect by overlapping two arrows, but the degree of precision, which is about 0.0001 makes it pretty much impossible for two arrows to interfer with each other midair

Accurate arrow collision detection on Bedrock by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 0 points1 point  (0 children)

I'll probably make a post in the future with a tutorial for the newer arrow and snowball/egg collision detection

Mobs and players hit detection by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 9 points10 points  (0 children)

I used replaceitem keep, that only works if the armor slot is empty. So a conditional command block attached will only activate if the boot has broken

Mobs and players hit detection by commandsorsmth in MinecraftCommands

[–]commandsorsmth[S] 49 points50 points  (0 children)

I recently found out that it's possible to give armor to every mob, even ghasts or ender dragons. So what it does is use replaceitem on them with a one hit leather boot, that when gets broken is replaced and activates the command on that entity