General Image Question/ Specifically Spout?

Discussion in 'Plugin Development' started by NeoSilky, Nov 4, 2011.

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

    NeoSilky

    Yeah, so I was thinking about custom blocks, and say for example, you can load a 256x256 .png image as the texture, which contains many textures for the blocks, but when coding, how do you say which area is the area the ore is?

    Kinda confused :p

    @Wulfspider
    @Afforess

    Edit: i found out you use:
    Code:
    		super(plugin, name, new GenericCubeBlockDesign(plugin, plugin.OreTexture, id));
    
    to get the texture, but it shows my pretty pink and black 'null' background :p
     
  2. Offline

    Blackside921

    You load your Texture using:
    Texture OreTexture = new Texture(plugin, String url, 256,256,int singleblocksize);

    now you can create your Block using:
    int[] id = {top,side1,side2,side3,side4,bottom};
    YourBlock block = new YourBlock(this,"MyAwesomeBlock",id);

    In the id part you put the numbers of which part of your texture you want to use.
    So 0 would be the top left and 1 the one right beneath it.
    Make sure to completly restart your server and client when testing.
     
  3. Offline

    NeoSilky

    so top left is 0, the one right of that is, 16? :)
     
  4. Offline

    Blackside921

    No. The one right of that is 1 and after that comes 2 and so on.
    When you create your Texture using what if posted above you need to set singleblocksize to the size of one block in your texture. So if your blocks are 16x16 it has to be:
    Texture OreTexture = new Texture(plugin, String url, 256,256,16);
     
  5. Offline

    NeoSilky

    Oh, sorry, I didn't get the positioning :p Thanks a lot! Seriously! :D
     
Thread Status:
Not open for further replies.

Share This Page