• 0

    posted a message on [Functions] Automatic seed planting via dispensers/droppers

    Very nice! Brilliant idea and execution. I really like the simplicity of the concept.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Does the /setidletimeout command work in command blocks?

    Like many administrative commands, the setidletimeout command cannot be used in command blocks.

    https://minecraft.gamepedia.com/Commands#setidletimeout

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Make item unable to despawn or get destroyed
    Quote from ShelLuser»


    For now. The "but it works" is not a good argument for not respecting the correct syntax. See: before 1.12 using spaces in names without using quotes was basically also wrong but "it worked" so some people never bothered. And then Mojang made syntax checking on names more strict for both better optimization but also making it more error prone (assumption on my part). As a result all those players who didn't bother with quotes had to rebuild their stuff.

    This is no different. It may work for now, but the moment things become more strict again (and I seriously expect something to happen in 1.13) then you may very well run into problems (again) because you didn't use the right syntax from the start.


    (edit)


    And well, it's not exactly hard to look these values up.


    That's actually not why it still "works". It appears to work because if you set a value higher than the maxsize (65535), it will overflow. 999999%65535=16974. So you are still giving it quite a bit of health, but by setting it above the maxsize, you are actually giving it less health than you could be.
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Make item unable to despawn or get destroyed

    give the player the item you want to be kept

    /give @p stone 1 0 {despawn:0}


    and run the followimg commands in a repeating and a chain command block

    /scoreboard players tag @e[type=item] add special {Item:{id:"minecraft:stone",tag:{despawn:0}}}

    /entitydata @e[type=item,tag=special] {Age:-32768,Health:999999}


    Setting the health to 999999 will not work as expected because the maxsize of a short is 32767. So you need to set it to 32767s. This generally, will make it indestructible, however, if you don't want explosions to be able to move the item you can use Invulnerable:1b.
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on 1.12.1 Help in making a rocket launcher
    Quote from RobhieMattz»

    isn't there something like this? @e[name="Rocket Launcher",type=snowball]


    This will not work because when you throw a snowball it becomes a brand new entity and nothing from the item's nbt is retained.
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on 1.12.1 Help in making a rocket launcher

    it seems as if you are angry at me : (


    Sorry, I was a bit short. The basic idea is to give players a unique value on the scoreboard and, during the tick the snowball is created, give the snowball the same value as the closest player that has thrown one. Using a temporary objective, subtract all players value from the snowball's and the snowball belongs to the player whose score equals 0.
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on 1.12.1 Help in making a rocket launcher
    Quote from RobhieMattz»

    It works but can I make it only work for a custom snowball?




    You can. You need to tag a player holding the custom snowball at the end of the command cycle. At the beginning of the cycle you need to check if a player has the tag and has a value of 1 for a stat.useItem.minecraft.snowball scoreboard objective. Then apply a tag to the closest snowball to that player, reset the players scoreboard objective, and remove the tag from the player. Now you can summon the fireball at the tagged snowball here. Then what I said at the beginning about tagging players holding the snowball will go here, after everything else.


    Edit: Oh and then you will change the "execute @e[type=minecraft:snowball]" command for summoning the fireball to "execute @e[type=minecraft:snowball,tag=custom]".


    you can tag snowballs and use entitydata on them but you cannot detect the player who has thrown it in multiplayer environment.




    Yes you can. It's not simple and I won't go into it, but yes. You entirely can do it.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on How to detect a fishing rod hook in a specific block?

    /execute @e[name=unknown] ~ ~ ~ detect ~ ~-1 ~ stained_clay 4 /teleport @p @s


    This is not how the teleport command works. In this case, you need to use tp. Not only that, but the block id is "minecraft:stained_hardened_clay", you should detect less than a full block below the bobber, and finally targetting the closest player will not be multiplayer friendly.

    Here is a fixed command, I'm leaving it with @p in the mean time, but you should come up with a different way:

    execute @e[name=unknown] ~ ~ ~ detect ~ ~-0.2 ~ minecraft:stained_hardened_clay 4 tp @p @s
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on 1.12.1 Help in making a rocket launcher

    Or simply this one command:


    execute @e[type=minecraft:snowball] ~ ~ ~ summon minecraft:fireball ~ ~ ~ {direction:[0.0d,0.0d,0.0d],ExplosionPower:1}


    Be sure you have the mobGriefing gamerule set to false.

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Is there a way to test player count without compactor?

    Impulse:

    /scoreboard objectives add Players dummy

    Repeating:

    /scoreboard players set Count Players 0

    Chain:

    /execute @e[type=armor_stand] ~ ~ ~ execute @a[r=2] ~ ~ ~ /scoreboard players add Count Players 1

    /scoreboard players test Count Players 10

    Chain Conditional:

    /say there are 10 players here


    He said this is within a function, so here is a function-friendly method:

    scoreboard players set @e[tag=playerCheck] Players 0
    execute @e[tag=playerCheck] ~ ~ ~ execute @a[r=2] ~ ~ ~ scoreboard players add @e[tag=playerCheck] Players 1
    function foo:bar/enoughplayers if @e[tag=playerCheck,score_Players_min=10]

    Just be sure to add the dummy objective "Players" and tag the armor stand with "playerCheck".
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Advancement reward function running off of player instead of console
    Quote from codewow»

    I don't want the player running the command.

    What is happening is when a player gets an advancement, the command is being issued, but it's being forced/sudo issued to run from the player's perspective/permissions.

    What should be happening is when the reward command is ran from the advancement, the console should run the command instead. That's not happening at this point and I'd like to know if it is possible.

    That is normal behavior. When you complete an advancement, you run the commands. No way around it.
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on testfor fishing rod bob in mob
    Quote from ShelLuser»

    Good find on the r=0 parameter, have to admit that I didn't test that.


    However, there's no direct need to mess around with height too much, you can also use r=0.1 which will work fine on all entities as well.


    Radius does not allow decimal values. Well allow may be the wrong word. They are allowed, but do not do what you would think. I'm not certain of exactly what it does, but it seems to act the same as negative values do. Negative values change the functionality entirely, no longer is it a matter of distance, but a matter of dimension. Here is what the wiki says about negative values:

    "Using a value under 0 restricts the targets to the same dimension the command was run from without applying a restriction on distance from the location of execution."
    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on Minecraft 1.12.1 Scoreboard / Advancement for opening inventory?

    Huh.. It appears to have been removed... You might have to settle for using an older version.


    Edit: Or you may be able to use custom advancements.

    Posted in: Commands, Command Blocks and Functions
  • 1

    posted a message on Help? how to remove the dragon egg after killing the ender dragon

    You could use fill replace executed from the dragon_egg item the dragon will drop to replace any nearby dragon_egg blocks with air:


    scoreboard players tag @e[type=minecraft:item,tag=!dragon_egg] add dragon_egg {Item:{id:"minecraft:dragon_egg"}}

    execute @e[tag=dragon_egg] ~ ~ ~ fill ~15 ~15 ~15 ~-15 ~-15 ~-15 minecraft:air 0 replace minecraft:dragon_egg

    Posted in: Commands, Command Blocks and Functions
  • 0

    posted a message on testfor fishing rod bob in mob
    Quote from ShelLuser»

    /execute @e ~ ~ ~ testfor @e[r=0,name=unknown]


    Well actually, r=0 will not work for any entities I have tested. When the bobber is hooked onto an entity, it is offset from the host's coords.

    For a non-baby zombie, this offset is 1.56 above on the Y axis. (This is why a radius of at least 2 is required for this test.)

    You could add the offset to the execute command (shown below), but then it would only work for 2 block tall entities..

    execute @e[name=unknown] ~ ~-1.56 ~ execute @e[name=!unknown,r=0] ~ ~ ~ say hi

    For baby zombies, the offset is 0.78. Items have an offset of 0.2.

    I'm not going to test other entity's offsets, but it seems to be scaled based on height. (78% of height.) This seems to be true for items as well, but I'm not really sure of their exact height..


    Edit: So I decided to make one more test. I thought about shulkers and how they are exactly 1 block tall, found the bobber is offset by 0.8 blocks making the offset exactly 80% of the height of the host above the host's origin.


    To get the offset, I attached the bobber and ran this command:


    /tp @e[name=unknown] ~ ~ ~


    This prints the entities coordinates. Subtract the host's coordinates and you are left with the offset.


    This means baby zombies are 0.975 blocks tall, regular zombies are 1.95, and items are 0.25. I checked the wiki and discovered it contains the heights for most common entities, but several are missing, like items. So now we have a fairly viable means to calculate the height for uncommon entities.

    Posted in: Commands, Command Blocks and Functions
  • To post a comment, please or register a new account.