• 0

    posted a message on [Solved] Whats the 1.13 equivalent of /testfor?

    /kill @e[type=item,nbt={Item:{"id":"minecraft:saddle"}}]

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Display final stats despite attibute modifiers

    I believe lore is the only way to accomplish this

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Check if text is X

    Here is a world download to a map I made that should do the trick. The general idea is that players start at y = -60 and every time they answer a question correctly they move up to the next room which is 5 blocks above them. You can decorate the rooms however you want just make sure they can't get out of the room otherwise the teleports will get messed up (you should also put the question inside the room on a sign or something). To get setup simply do

    /tag yourname add Teacher


    Make sure you have operator perms. If you don't, open the world to LAN and enable cheats.


    After you have the Teacher tag you will receive 2 books. One of the books will give you a tutorial on how to finish setting up, while the other book will contain commands such as teleporting to useful places as well as the option to reset an activity (hover over the options in the book to learn more before clicking them). All of the blue words in the command book are clickable. If you have any questions I'd be happy to help. I think your idea is really cool :D


    Btw the final room at the very top (under the highest roof) is where players will be teleported once they finish the test. I should also note that I only added support for quizzes/tests of 25 questions or fewer (you can always do back to back tests if you change the answer key and use the reset command)


    https://www.mediafire.com/file/idr56ua5y84ihp8/Spelling.zip/file

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Executing a command from the inventory

    Ahhh my bad I misunderstood what you were going for. Yes it is possible to do this although it's a bit more complicated. Can you tell me exactly what you're trying to accomplish so I know how in depth I should go when explaining it? For example, is it just one item you want to detect? Do you want it to be in a chest or player inventory? Will there be other stuff in the chest? Do you want there to be pages?

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Help on command plz!

    Before I get into the solution I'd like to give a few helpful tips. As far as I can tell, your @e selectors seem a little overkill. Since only players have offhand slots, there's no reason to use @e in this scenario. Using @a will make your commands more efficient. Additionally, the nbt for your custom name, {display:{Name:'{"text":"stone","color":"gold",bold":"true",italic":"false}'},Block:1b}, should be {display:{Name:'{"text":"stone","color":"gold","bold":"true","italic":"false"}'},Block:1b}. Now for the issue and how to resolve it.


    The issue is that replaceitem replaces a slot with a specific number of items provided by you (if no number is provided it will default to 1). That's why you always end up with 1 item in your mainhand. To fix your issue you can simply replace

    execute as @e[nbt={Inventory:[{id:"minecraft:smooth_stone_slab",Slot:-106b}]}] run replaceitem entity @a weapon.mainhand minecraft:smooth_stone_slab{display:{Name:'{"text":"stone","color":"gold",bold":"true",italic":"false}'},Block:1b}

    with

    execute as @a[nbt={Inventory:[{id:"minecraft:smooth_stone_slab",Slot:-106b}]}] run give @s minecraft:smooth_stone_slab{display:{Name:'{"text":"stone","color":"gold","bold":"true","italic":"false"}'},Block:1b} 63

    This will add 63 to the amount in your offhand and the overflow will spill into your inventory, then your command to set the offhand slot to air will remove the extra items so you end up with 1 less item than you started with. The only downside is that you don't have control over what slot the items go into. If you really want to maintain the slot and sacrifice some performance you could do 64 checks to see how many items are in your offhand and have a replaceitem command for every possible number.


    That would look something like this:

    execute as @a[nbt={Inventory:[{Slot:-106b,id:"minecraft:smooth_stone_slab",Count:64b}]}] run replaceitem entity @s weapon.mainhand minecraft:smooth_stone_slab{display:{Name:'{"text":"stone","color":"gold","bold":"true","italic":"false"}'},Block:1b} 63
    execute as @a[nbt={Inventory:[{Slot:-106b,id:"minecraft:smooth_stone_slab",Count:63b}]}] run replaceitem entity @s weapon.mainhand minecraft:smooth_stone_slab{display:{Name:'{"text":"stone","color":"gold","bold":"true","italic":"false"}'},Block:1b} 62
    execute as @a[nbt={Inventory:[{Slot:-106b,id:"minecraft:smooth_stone_slab",Count:62b}]}] run replaceitem entity @s weapon.mainhand minecraft:smooth_stone_slab{display:{Name:'{"text":"stone","color":"gold","bold":"true","italic":"false"}'},Block:1b} 61
    execute as @a[nbt={Inventory:[{Slot:-106b,id:"minecraft:smooth_stone_slab",Count:61b}]}] run replaceitem entity @s weapon.mainhand minecraft:smooth_stone_slab{display:{Name:'{"text":"stone","color":"gold","bold":"true","italic":"false"}'},Block:1b} 60
    execute as @a[nbt={Inventory:[{Slot:-106b,id:"minecraft:smooth_stone_slab",Count:60b}]}] run replaceitem entity @s weapon.mainhand minecraft:smooth_stone_slab{display:{Name:'{"text":"stone","color":"gold","bold":"true","italic":"false"}'},Block:1b} 59
    ...

    For 1.16.5 I believe these are your best options; however, if you were in a later version you could replace the player's mainhand with a loot table that had its count set from a scoreboard value that contains the stack size of the player's selected slot (you would just have to remove 1 from the score before using it to set the count of the items in the loot table).


    I hope this was helpful or at least informative in some way. Best of luck in your minecraft command adventures!

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Executing a command from the inventory

    It kinda depends what item you want to right click. If it doesn't matter what the item is, you can use a carrot on a stick. Create a scoreboard objective for it and check whenever a player's score is 1 or greater.

    scoreboard objectives add right_click minecraft.used:minecraft.carrot_on_a_stick
    execute as @a[scores={right_click=1..}] run <your command>

    If you want it to be a specific item that you can't detect right clicks from, you could put an item (like a carrot on a stick) in the offhand slot and check whenever the player uses that item and run a command if their selected item is the item you want to be clickable. For this method to work though you would have to make sure the item you want them to right click doesn't interfere with the item in their offhand. For example if the item you want the player to right click is a block, and the player is able to place the block, when the player right clicks, the right click will place the block, not trigger the carrot on a stick. In that case you would have to either set the player to adventure mode or scrap the offhand right click detection method and instead check for when a player places a block then maybe do a raycast to approximate where the player placed the block and then another check around that area to make sure you don't miss completely then remove the closest block to where your raycast ended and then replace the block in their inventory and run whatever command you want to run when they right click that specific block in their inventory (you could also have a controlled environment and make sure there are none of that type of block nearby and just replace any of that type of block with air in the radius that the player could have placed the block).

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Command block Question

    For Teleporting After Killing Just One of Any Mob:


    Create an advancement that rewards the normal function below:

    {
      "criteria": {
        "requirement": {
          "trigger": "minecraft:player_killed_entity",
          "conditions": {
            "player": [
              {
                "condition": "minecraft:inverted",
                "term": {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "targeted_entity": {
                      "type": "minecraft:player"
                    }
                  }
                }
              }
            ]
          }
        }
      },
      "rewards": {
        "function": "namespace:function_name"
      }
    } 

    In a normal function (this is the function that is being rewarded):

    advancement revoke @s only namespace:advancement_name
    tp @s ~ ~3 ~

    Change ~ ~3 ~ to whatever coords you want the player to be teleported to


    Link to datapack: https://www.mediafire.com/file/n1mi50tymvleo7l/TP+After+Killing+(One+Mob).zip/file


    For Teleporting After Killing a Certain Amount of Mobs:


    In a load function create a scoreboard to keep track of mob kills:

    scoreboard objectives add mob_kills dummy

    Use the same advancement but this time reward a function that checks how many kills the player has:

    {
      "criteria": {
        "requirement": {
          "trigger": "minecraft:player_killed_entity",
          "conditions": {
            "player": [
              {
                "condition": "minecraft:inverted",
                "term": {
                  "condition": "minecraft:entity_properties",
                  "entity": "this",
                  "predicate": {
                    "targeted_entity": {
                      "type": "minecraft:player"
                    }
                  }
                }
              }
            ]
          }
        }
      },
      "rewards": {
        "function": "namespace:function_name"
      }
    }

    In a normal function (this is the function that is checking the kills):

    advancement revoke @s only namespace:advancement_name
    scoreboard players add @s mob_kills 1
    execute if score @s mob_kills matches 4.. run function namespace:function_name

    Change 4 to the amount of kills you want the player to have before being teleported


    In another normal function (this is the function that is executed if the kill requirement is met):

    scoreboard players reset @s mob_kills
    tp @s ~ ~3 ~

    Change ~ ~3 ~ to whatever coords you want the player to be teleported to


    Link to Datapack: https://www.mediafire.com/file/bkbalzyr6r91rxo/TP+After+Killing+(Custom+Amount).zip/file


    NOTE: This is how to check if ANY entity (mob) is killed. If you only want to check if a player kills a certain mob you would have to either use a scoreboard that counts kills for that mob or change the advancement to only check for kills on a specific mob. Also I only stopped kills on players from counting towards overall mob kills (I don't think breaking an item frame counts as an entity kill at least not from my tests but there could be some unwanted entities counting towards mob kills).

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Make zombies passive

    Replace every zombie_repellent:1b in my commands with zleg:1b since that's the tag you chose to use for your leggings.


    The way you give the items doesnt really matter as long as the item has the tag. In my example I used zombie_repellent:1b but in your give command you used zleg:1b so just make sure you're testing for leggings that have the tag that you used in your give command.


    Sorry for the late reply.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Execute Entity If Positioned not working?

    execute align xyz as @a[x=-956,y=65,z=-179,dx=0,dy=0,dz=0] run tp @s 500 500 500

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Make zombies passive

    You can do this with teams:

    team add zombie

    team modify zombie friendlyFire false

    In something that constantly ticks add players that have the pants to the team and remove them if they don't have the pants. Make sure to add a command that adds zombies within a certain radius to the zombie team as well:

    execute as @a[nbt={Inventory:[{Slot:101b,tag:{zombie_repellent:1b}}]}] run team join zombie

    execute at @a[team=zombie] run team join zombie @e[type=minecraft:zombie,distance=..25]

    execute as @a[team=zombie] unless data entity @s Inventory[{Slot:101b,tag:{zombie_repellent:1b}}] run team leave @s 

    To give pants that will repel zombies use this command (they can be any kind of leggings just add the {zombie_repellent:1b} at the end):

    give @p minecraft:diamond_leggings{zombie_repellent:1b}

    Here's a link to a datapack I made that does exactly what I just explained: https://www.mediafire.com/file/86mqv403trvy09s/Zombie+Repellent.zip/file

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Run spreadplayers when players hits water

    It should work perfectly fine if you get rid of one of the tildes in the second part

    execute as @a at @s if block ~ ~ ~ water run spreadplayers ~ ~ 500 500 false @s
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Unbreakable dirt

    The unbreakable tag is for items that have durability like swords and armor. As far as I know the work around with barriers you came up with is most likely the best it'll get unless you do something like creating regions with markers or using dx dy and dz checks and then changing their gamemode if they're within a certain amount of blocks of a marker/in a region.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Help: Commandblock teleport me and horse
    /execute as @e[distance=..3] at @s if block ~ ~-1 ~ clay run tp @s -973 63 -94
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on /data With Glow Item Frame

    Here's your command to set it to red concrete:

    [noparse]/data merge entity 2234808c-b625-487b-b712-0701eff496d8 {Item:{id:"minecraft:red_concrete",Count:1b}}[/noparse]

    And here is your command to clear the item frame:

    [noparse]/data merge entity 2234808c-b625-487b-b712-0701eff496d8 {Item:{Count:0b}}[/noparse]

    If you want to automate this I'd recommend using a datapack and doing a time query and then doing some conditional commands based on what you consider to be day/night in game ticks (this is the better option if you don't want to touch your world at all).


    Your other option is to do some basic redstone using a daylight detector to power command blocks.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Is there a command to remove chests from llamas?

    Stand right next to the llama so that no other llama is closer and run the command:

    /data modify entity @e[type=llama,limit=1,sort=nearest] ChestedHorse set value 0b
    Posted in: Commands, Command Blocks and Functions
  • To post a comment, please .