Jump to content

using this method public int getBlockTextureFromSideAndMetadata(int i, int j)


jamesscape2

Recommended Posts

k so im making my mod and my machines im making are running of 1 id,  how can i change this method so that , depending on the blocks metadata it will select the right texture  heres what i tried which didnt work at all

 

 

@SideOnly(Side.CLIENT)

public int getBlockTextureFromSideAndMetadata(int i, int j, World world, int x, int y, int z)

{

int meta = world.getBlockMetadata(x, y, z);

// If no metadata is set, then this is an icon.

if (j == 0 && i == 3) {

return 0 * meta ;

}

 

if (i == j) {

if (!isActive)

return 0 + 1 * meta - 1;

else

return 1 * meta;

}

 

switch (i) {

case 0:

return 3 * meta;

case 1:

return 4 * meta;

default:

return 2 * meta;

}

}

 

Or what other method do i need to use to set the texture,  remember it has to work with orientation code too

 

thanks

Link to comment
Share on other sites

k so im making my mod and my machines im making are running of 1 id,  how can i change this method so that , depending on the blocks metadata it will select the right texture  heres what i tried which didnt work at all

 

 

@SideOnly(Side.CLIENT)

public int getBlockTextureFromSideAndMetadata(int i, int j, World world, int x, int y, int z)

{

int meta = world.getBlockMetadata(x, y, z);

// If no metadata is set, then this is an icon.

if (j == 0 && i == 3) {

return 0 * meta ;

}

 

if (i == j) {

if (!isActive)

return 0 + 1 * meta - 1;

else

return 1 * meta;

}

 

switch (i) {

case 0:

return 3 * meta;

case 1:

return 4 * meta;

default:

return 2 * meta;

}

}

 

Or what other method do i need to use to set the texture,  remember it has to work with orientation code too

 

thanks

 

I don't know what that code is suppose to be doing, but 'i' tells you the meta, and 'j' tells you which face you need to return.

 

You could do something like this:

 

//Where does this blocks textures start

int OffSet = 0;

return OffSet + (i * 6) + j;

 

That could work if there is a different texture for every side and meta possibility, in order. Otherwise you will need some logic to determine the situational texture to use.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.