[blog] Upgrading my redstone world to 1.10

Discussion in 'General Minecraft Discussion' started by ShelLuser, Jul 14, 2016.

  1. Part I

    Hi gang!

    One of the things which I like best about Minecraft is tinkering. Things like redstone contraptions but also messing with the game itself. Command blocks, changing villager behavior and doing some simple yet crazy things. For this reason I set up my old (redstone / sandstone) world where I can experiment with all this.

    Best Minecraft Servers
    My redstone world...

    Now, personally I prefer playing on Minecraft 1.8 (also because of the laggy stuff on 1.9) but today I still decided to upgrade this world to 1.10. Thing is: it never hurts to get up to speed with the current mechanics and even though I don't like some parts it's still fair to say that Mojang also added some good stuff.

    So the first thing I noticed was that my pet villager didn't want to trade with me anymore. That was a bummer for sure :(

    Best Minecraft Servers
    C'mon, I only boiled you in lava twice. or... maybe it was 6 times but no more than that! :D

    This was (roughly) the command I used. I already made some changed before I thought about saving & writing it all up, and I'm too lazy to restore this level from a backup :p

    summon Villager ~ ~1 ~-1 {CustomName: "Villager #19",Profession:6,Career:1,CareerLevel:6,Offers:{Recipes:[{buy:{id:263,Count:1},sell:{id:388,Count:4}},{buy:{id:137,Count:1},sell:{id:276,Count:1}},{buy:{id:24,Count:1},sell:{id:137,Count:1}},{buy:{id:276,Count:1},sell:{id:24,Count:1}},{buy:{id:388,Count:1},sell:{id:384,Count:8}}]}}
    The fun thing about villager #19 (I got the name from Element Animations ;)) is that it has a set of trades which you normally can't get:
    • One coal gets you 4 emeralds.
    • One command block gets you a diamond sword.
    • One sandstone block gets you a command block.
    • One diamond sword gets you a sandstone block.
    • And the ultimate: 1 emerald gets you 8 Bottles o' Enchanting :)
    It's a bit silly: get a sandstone block and you get a command block, then using that you can get a diamond sword and if you decide not to kill the villager with it you can get your sandstone block back.

    I started experimenting and immediately noticed that I had to change the Profession, Career and the CareerLevel. If you set the Career to an illegal value then for sure: you don't get any trades. But my own trades still didn't show up, even if I wanted to trade stone for stone (which is the default id value). It's a good thing for bugfixing these things: remove elements until things work, then add them back in one at a time until it breaks again. Of course, reading the Minecraft wiki Villager page also helped, especially the data value section.

    Then I remembered reading something about changed id values. Could it be... And for sure: changing the ID numbers to real names sorted things out. Did you know that in your creative pages all items are sorted by ID value? Well, now you do :)

    This is the new command which I'm now using in 1.9/1.10:
    summon Villager ~ ~1 ~-1 {CustomName: "Villager #19",Profession:6,Career:1,CareerLevel:6,Offers:{Recipes:[{buy:{id:"coal",Count:1},sell:{id:emerald,Count:4}},{buy:{id:"command_block",Count:1},sell:{id:"diamond_sword",Count:1}},{buy:{id:"sandstone",Count:1},sell:{id:"command_block",Count:1}},{buy:{id:"diamond_sword",Count:1},sell:{id:"sandstone",Count:1}},{buy:{id:"emerald",Count:1},sell:{id:"experience_bottle",Count:8}}]}}
    SO if you want to make your own villagers in your own Minecraft game: this is how you do it :cool:

    And this brought me to another problem: my day/night cycle. You see: I don't like working in the dark, but I also don't like having the sun in one fixed location. So I set up a construction which simply skips the night ;)

    And worse! :eek: Every time you 'dismiss' the villager "something" happens. Normally invisible, but since I was debugging I enabled commandBlockOutput:

    Best Minecraft Servers
    18 times? Villagers #19 is going to hate me for that :p

    So I decided to add something silly to my day/night "shift" routine: it randomly triggers, and when it does it "punishes" all players who have a 'revenge' score of more than one :mad: Only problem: this didn't work correctly after the upgrade :(

    Best Minecraft Servers

    There are 2 types of light sensors: the normal one which generates more redstone output when there's more light available (so the sun sits higher in the sky), and an inverted one which worked the other way around (more power when the light dropped). So if the regular one generated a value of 13 hen the inverted one would generate 2 (15 is the maximum value of a redstone charge).

    In 1.9 this got nerfed: inverted daylight sensors no longer sent out a signal at all until the sun starts to set. Why's that bad? Simple: because the light levels also drop when the weather changes, and this is also picked up by the inverted sensor.

    So simply put: it is no longer possible to detect sunset using only an inverted daylight sensor, this worked just fine in 1.8. It wouldn't be so problematic if you could simple stop the weather cycle from happening, but that's a function which Mojang apparently never thought off.

    Oh, and in case you wonder what the ghost of villager #19 actually does.. Well, uhm...

    Best Minecraft Servers

    I borrowed the idea from the zombie virus ;)

    Next part: Son of Momentus :)
    607, Patr1cV, Vizsco and 4 others like this.
  2. Seems like I should try messing with some of this again. It's been a long time since I toyed with redstone or command blocks.
    607 and ShelLuser like this.
  3. Cool, someone else who likes to mess with redstone/command blocks. :)
    Nah, he's just the best villager ever. Maybe he can teach every villager his ways...
    Nvm... xD
    That is really sad, I haven't used daylight sensors lately so I never knew about this. It is however still possible to detect the time of day no matter the weather though, Mojang just made it more complex than it should be. If you put the following inside a repeating command block, it won't do anything...
    /time query daytime
    However if you set the players score to 0 on a scoreboard objective and run the following stats command in chat, the game will start keeping track of the time for you to use...
    /scoreboard objectives add Time
    /scoreboard players set @p Time 0
    /stats block X Y Z set QueryResult @p Time
    X Y and Z should be replaced with the co-ords of the command block mentioned above.
    Anyways, from here all you would have to do is this for example to detect the sunset... :)
    /execute @p[score_Time=13500,score_Time_min=12500] ~ ~ ~ say Another amazing sunset... :)
    So although that wasn't perfect, hopefully it helps solve that problem you were having... Still sad you can't do such in survival anymore though...
    That's one angry villager, do you think he stole a Zombie Virus from one of our beloved Enraged Zombies and made it into a Splash Potion of Zombie Virus?!? (I'm joking of course. xD)
    Cool, looking forward to it... :D
    607 and ShelLuser like this.
  4. Yeah, I like your day/night solution Supereri0n but I have one problem with it: I dislike those repeating commandblocks :) Problem is that they gobble up precious server resources and I'm always a bit worried about adding to the lag here.

    Maybe for nothing; I'm still testing. But I've played with many command block machines (you know: from http://ijaminecraft.com) and they all have one thing in common: they lag your game :confused:

    That's the fun part: you still can (somewhat) by combining the output from both sensors. I'm not going to spoil too much for now (is for the next part) but: when dawn hits my world (y56) then the output from the inverted daylight sensor and the regular one is the same! And when bad weather hits my world then the output from the normal sensor doesn't drop, whereas the output from the inverted sensor goes up (kinda illogical behavior if you ask me).

    But that last detail is key here. Compare both outputs and act on an equal signal.

    Even so: I am definitely going to try your example later this weekend, and thanks a bunch for sharing it! So far I haven't done all that much with those repeat commandblocks and I can really use the experience.
    607, Patr1cV and SUPERI0N like this.
  5. Part II

    I should be asleep by now (well, not really, but I should definitely be trying to catch up on some) but meh, it's a sauna here :( So, going to do something to take my mind of things, then trying again later :)

    Day / Night cycle

    As mentioned above my "night skipper" set up no longer worked. I used to have an inverted daytime sensor hooked onto a comparator and I compared it with the value 11, this value got sent out whenever the sun was precisely at the horizon. But no more in 1.10 :confused:

    Best Minecraft Servers
    I actually managed to dig up a backup copy ;)

    And while I was at it: using a redstone torch and then moving it away until you got the right value is a simple and cheap way to do it, but it's not very compact either. So I started experimenting and noticed a few things:
    • Both variants of the daylight sensor give out the same value at dusk, namely 4.
    • During bad weather (day time) the regular sensor always has a higher value than the inverted one.
    • Minecraft 1.8 introduced new redstone power sources ;)
    And that gave me all the info I needed. Honestly: at first I was a little annoyed when I noticed this change but I also have to admit that this opens up many new possibilities. How I solved my problem? Simple: they don't call it a comparator for no reason:

    Best Minecraft Servers
    Regular daylight sensor on the left, inverted one right.

    What is happening here: the comparator compares the output from both sensors, but it will only sent out a value once the side-input is equal or lower than the main input. And because I had already determined that the daylight sensor always has a higher value during the daytime there is no way for this to trigger during bad weather, only when the sun sets. I have to give Mojang credit: this setup also works when dusk hits during bad weather.

    And as you can probably tell I also improved the power sources. Are you wondering what could possibly be sending out a value of 4? Well...

    Best Minecraft Servers

    Item frames now give out a redstone signal based on their rotation, which makes them ideal redstone power sources if you need a specific amount (like 4) while you don't want to bother with having to calculate what 15/9 is, which you'd have to with a dropper or dispenser (a redstone charge has a maximum value of 15, and a dispenser (or dropper) has only 9 slots. so one filled slot will give out 15/9 = 1.66 output, which will show itself when you fill the slots partly (using half a stack of items for example)).

    But that's for an upcoming redstone tutorial ;)

    Right now I solved my day/night cycle problem! Final comment: the command block only adds a value to the time to skip the night: "time add 10950"

    Son of Momentus (work in progress)

    We all know the super turkeys on the Empire, right? I love those critters, especially when looking back at how hard it was to kill them :) I wanted to know how this works, and I also wanted to troll my gf with it (who doesn't particularly like chickens) ;)

    So I ended up with my 'Momentus' corner as I like to call it. I set up command blocks which mimic the spawning of "Momentus" (just a giant zombie, it doesn't fight you), one which creates an 'enraged chicken', and.... One which creates a creature which I dubbed "Son of Momentus". It's actually a baby zombie (with leather pants) which is riding an enraged chicken. Really funny, and also quite deadly because of the high speeds.

    Unfortunately nothing worked anymore :(

    Best Minecraft Servers

    It is a giant zombie, but it doesn't have any items and I'm also missing the red text. So a lot of things go wrong here. When I tried to spawn the enraged chicken and the zombie I noticed a few more problems: the chicken doesn't have super high hitpoints so can be killed with one stroke, and the baby zombie is also just that: no pants, no riding a chicken, no nothing.

    But honestly: this is why command blocks are so cool: they tell you exactly what's going wrong when something doesn't work anymore:

    Best Minecraft Servers

    Further study showed that the /title command got changed: it now uses strict JSON syntax, whatever that is ;) Well: it boils down to having to encapsulate all used values and items. So instead of using this:
    title @a[r=20] title {text: "The ground shakes nearby", color: "red"}
    I now had to use this:
    title @a[r=20] title {"text": "The ground shakes nearby", "color": "red"}
    So, let's focus on "Momentus" first and get into the more complex stuff later. Spawning a mob in has also changed (duh!) and I think in some cases for the better, it makes it easier to understand the new syntax. Of course, it also means you need to get used to that new syntax ;)

    The old code which I used:

    /summon Giant ~ 58 ~-5 {Equipment:[{id:wooden_sword,count:0,tag:{ench:
    Now, the Giant has no AI so nothing really happens here. The main thing which got changed is the Equipment tag. Equipment used to denote everything which a mob had, 5 things in total. So what it had in its hand (back in 1.8 we only had 1) and what it wore (4 things).

    Because a lot changed we now have to specifically determine what items a mob holds in its hand (HandItems) and which its wearing (ArmorItems). Makes perfect sense to me!

    So the new code:

    /summon Giant ~ 58 ~-5 {HandItems:[{id:"wooden_sword",count:0,tag:{ench:
    It's still a pretty dead/dumb zombie, but I like how this - when combined with my /title command - mimics Momentus a bit.

    And I have to admit... Even though I enjoyed the old command blocks ("Using command blocks also requires that you know some redstone basics") and personally like their appearance better (I dislike arrows which point at nothing ;)) I also admire the new. They're most certainly versatile!

    In the old days I triggered one commandblock and used redstone to trigger the next. As a result the other command block used to sit in a completely different location. No more!

    Best Minecraft Servers

    You can still use the old behavior with redstone if you so chose, but you got to admit that this is much more compact, and also easier on me if I have to change something in the future.

    More to come still ;)

    Right, so far for part II. Next we'll be looking at 'Son of Momentus' in more detail and I'll also share my new spawner code (making your own custom mob spawners, which (IMO) is totally cool!).
    607, SUPERI0N and Patr1cV like this.
  6. Part III - Enraged chickens

    A brief dive into JSON

    Some players were asking about the JSON stuff, it looks very complex. Well, honestly: I think it looks more overwhelming than it actually is. First: JSON (JavaScript Object Notation) is nothing more but a set out standard on writing down objects and their properties. The main idea is to make something which syntax is relatively easy for us humans to grasp and very easy for a program to process.

    It's really not that hard: {} often contains several values which usually work like: {name,value}. If you have more things to share (in a name/value pair) then you'd use [] to group 'elements' together.

    Lets say I give myself a diamond sword: /give @p diamond_sword. But I really wanted Sharpness V on it, how to do that? First I could use /enchant to, well, enchant my currently held item: /enchant @p minecraft:sharpness 5. Always remember that you can use tab completion, so I simply typed: sha<tab> and wham: minecraft:sharpness. More information on the Minecraft commands page, here's the enchant command.

    Another option is to specify the enchant while I'm giving myself the sword. How to do that? JSON of course!

    /give @p diamond_sword 1 0 {ench:[{id:16,lvl:5}]}

    If you look carefully you'll see that {} contains all the extra options, ench uses [] because there could be more enchantments on one item (so it can use more elements) and an element is stored in a pair of {} again, where one element contains the id of the enchant and it's level.

    And this syntax is used throughout the whole thing.

    Enraged chickens

    I really love the super turkeys. They're so funny! It's especially fun if you see someone else go after them :p. So I wanted to re-create that, but as mentioned in an earlier post: it no longer worked. Here's what I used:

    summon Chicken ~ ~ ~-5 {Fire:32767,Attributes:[{Name:"generic.movementSpeed",Base:0.8},{Name:"generic.maxHealth",Base:256}],ActiveEffects:[{Id:12,Duration:32767,Amplifier:0,Ambient:-1}]}
    This command is actually quite easy: it summons a chicken which is set on fire for a long time (32767). To make sure that the chicken doesn't burn up I give it the fire resistance effect (id:12) which lasts for the same time, is not amplified through a beacon of some sort and it also doesn't show particles (Ambient).

    The problem: the chicken dies in one stroke. I started experimenting with health potions and I noticed that the chicken does have the high health amount, it merely doesn't start with a filled out amount right away. So what to do? At first I figured I'd give the Chicken some regen for a short moment which should bring his health back up to speed. Then I had a better idea: Absorption! Try it: /effect @p minecraft:absorption 10 4. This basically gives you twice your health for 10 seconds time. When mobs attack you they'll first need to go through the extra hearts.

    And guess what? AbsorptionAmount is an official attribute for mobs ;) So my new code:

    summon Chicken ~ ~ ~-5 {AbsorptionAmount:512,Fire:32767,ActiveEffects:[{Id:12,Duration:32767,Amplifier:0,Ambient:-1}],Attributes:[{Name:"generic.movementSpeed",Base:"0.8"}]}
    Note: Absorption 256 results in me having to hit a chicken around 20 times with a Sharpness V sword before it dies. So I prefer 512 to make the chicken hard to kill, but not too hard :)

    Next part we'll look at the baby zombie and how to make it ride the enraged chicken :)
    607 and SUPERI0N like this.
  7. Ha, that's some quite cool stuff you've got here, and I really like how you're explaining it! I bet I could understand most of it even if I wouldn't have too much experience with it myself!
    I really liked to do stuff like this too, I also had a "Redstone wereld", made out of sandstone. I started by playing with simple redstone, making traps and such, and later got into commands which I really enjoyed, even though it was very frustrating at times.
    I haven't really done anything like this in the past few years, though... the only place where I still used commands was in the custom map I was creating, but the fire, water and lava items being removed from the game made me unable to continue that map, unfortunately.
  8. poor redstone world you have:
    Best Minecraft Servers
    (I know this isn't relevant at any kind, but, I just need something that's good for my ego :p )
    607 and ShelLuser like this.
  9. Nah: young redstone world I have :) Compared to you I've only just begun playing. But give it time, you'll see....

    Which is a very important thing indeed!

    In the mean time I noticed that they also changed a few things in the spawner mechanics (which is one of my all time favourite blocks, right next to the command & structure block) and I'll probably be addressing that next time.

    That moment when: when you play an old (hardcore) map and forgot all about the customized spawners which you placed. Then you enter a certain area and you're chased by an army of zombie jockeys (baby zombie riding on an "enraged" chicken) :D

    I didn't survive that one btw :p
    Zrugite, Jelle68 and 607 like this.