Change material metadata for generation?

Discussion in 'Plugin Development' started by The_Slimer, Dec 17, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    The_Slimer

    I am new bolth to bukkit and Java so I am really sorry if the question I'm asking is common sense. My code bellow basicly generates a hilly terrain of the seamless stone slab type but I want to be able to change that from the stone slab to the seamless sandstone version (which is a data value of 9). I've not yet found a way to do this from my searches on the forums.

    Code:
    Random random = new Random(world.getSeed());
         
            SimplexOctaveGenerator octave = new SimplexOctaveGenerator(random, 8);
         
            octave.setScale(1 / 64.0);
         
            for (x = 0; x < 16; ++x){
                for (z = 0; z < 16; ++z){
                    blocks[this.coordsToByte(z, 0, z)] = (byte) Material.BEDROCK.getId();
                     
                    double noise = octave.noise(x + chunkX * 16, z + chunkZ * 16, 0.5, 0.5) * 12;
                 
                    for (y = 1; y < 32 + noise; ++y){
                        blocks[this.coordsToByte(x, y, z)] = (byte) Material.DOUBLE_STEP.getId();
             
                    }
                     
                blocks[this.coordsToByte(x, y, z)] = (byte) Material.DOUBLE_STEP.getId();
             
                }
            } 
            return blocks;
        }
     
    Last edited: Dec 18, 2014
  2. Offline

    wesley27

    @The_Slimer Well if you want it to generate with sandstone instead of the slab, you can just change the Material to the sandstone? I'm sure that's not actually what you're asking, as you clearly know how to do that based on your code. What exactly are you trying to do, your question isn't clear. Do you want to have the ability to do the sandstone or the slabs in your code? Or simply make it out of sandstone instead of slabs?
     
  3. Offline

    Skionz

    @wesley27 I believe his code is from a video and I am pretty sure he is asking for sandstone slabs. Not plain block shaped sandstone.
     
  4. Offline

    The_Slimer

    @wesley27 I am trying to get the seamless sandstone slab it is a "glitch" in the game that shows the top side of the sandstone on every side of it making it smooth. The Id for in game is 43:9 or minecraft:double_stone_slab:9 So I want to add the data value of 9 to the DOUBLE_STEP which gives it a texture that is not default to the game.
    DOUBLE_STEP with a data value of 9 looks like this:
    [​IMG]
     
  5. Offline

    Webbeh

  6. Offline

    The_Slimer

    @Webbeh Oh Yay! Thanks for informing me! Its good to know thats not going any where soon! Do you have any idea of how to solve my problem?
     
  7. Offline

    Webbeh

    I can't think of any solution that would be powerful enough. Only one I'm thinking about is to have the BlockPopulator look for all the doubleslabs and change their data value then, but that WILL be heavy.
     
  8. Offline

    Darkpicasa

    When you create the ItemStack, just set the data... Cast it to a short.
     
  9. Offline

    Skionz

  10. Offline

    Webbeh

    @Darkpicasa Just... read the first post and look why that would not work.

    Don't simply answer to one phrase of the whole topic..
     
  11. Offline

    The_Slimer

    @Webbeh As I said I am new to creating custom terrain with Bukkit so exactly how heavy would that be? Would it be almost the same as replacing a 100 block area with world edit (basicly crashing the server) or would it be usable on an average server without game breaking lag?
     
  12. Offline

    Webbeh

    I wouldn't know for sure. I never created a world generator, and don't think I will ever do, but I assume it will be almost as laggy as worldedit. I can be wrong though.
     
  13. Offline

    mythbusterma

    @The_Slimer

    It's no different than using Vanilla world generation, in fact it would probably be significantly faster, as your terrain isn't anywhere near as complicated as the Vanilla terrain is.


    @Webbeh

    Nowhere near as slow as WorldEdit is, WorldEdit does updates block by block, whereas chunk generation is indistinguishable from Vanilla, and likely faster.
     
  14. Offline

    The_Slimer

Thread Status:
Not open for further replies.

Share This Page