Creating block with specific texture?

A new update is now available, introducing seasons and more!
Latest hotfix: 0.8.0.1 (2024-12-20)
  • Hi,
    i want my plugin to create a 3x3 area of blocks with mithril texture in front of the player on the same height as the player is standing when issuing a command.
    My question is how to create such a textured block.
    I tried using this.getWorld().placeBlock() and managed to create a half-cylinder of wood in front of the player, but i have no idea how to change the texture or create a cube?
    this is my code:


    Java
    ItemDefinition id = Definitions.getItemDefinition((short)700); //block
    Vector3i cp = player.getChunkPosition();
    Vector3i bp = player.getBlockPosition();
    bp.setY(bp.getY()-1);
    bp.setZ(bp.getZ()+1);
    this.getWorld().placeBlock(700, cp, bp);

    Thanks for your help

  • Unfortunately the mithril texture isn't available for blocks... and there is no way to add custom textures via API right now =/ The only thing you could do is load the block as a custom 3d model (with a custom texture) to the game.
    However, if you want to place a regular block (with one of the existing block textures), make sure to provide a proper block id to the placeBlock() method (e.g. a number between 21 and 218 [or 0], these are the valid block textures), e.g: getWorld().placeBlock(182, cp, bp); //striped metal
    The block shape is encoded into the block id, so when using a higher value (up to 32k), you will get a different shape ;)

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!