Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.