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.

Mali Plavi

Members
  • Joined

  • Last visited

  1. So i have been trying to rotate a texture of a block face with no success. I have tried to do it with ISBRH, but it seems like every documentation of it is either outdated or i can't get it to work. I just need to rotate the top and the botom face of a block, because they are rotated the same way as always. Here is my code: package mali_plavi.automation.blocks; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import mali_plavi.automation.AutomationMain; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class AutomatorBlock extends Block{ private int x,y,z; private World w; public AutomatorBlock(String n, Material m) { super(m); this.setBlockName(n); this.setBlockTextureName(AutomationMain.MODID + ":" + n); } protected IIcon bottom; protected IIcon top; protected IIcon left; protected IIcon right; protected IIcon front; protected IIcon back; private int facing = 0; @Override public void registerBlockIcons(IIconRegister r){ this.bottom = r.registerIcon(textureName + "_bottom"); this.top = r.registerIcon(textureName + "_top"); this.front = r.registerIcon(textureName + "_front"); this.left = r.registerIcon(textureName + "_left"); this.right = r.registerIcon(textureName + "_right"); this.back = r.registerIcon(textureName + "_back"); } @Override public void onBlockPlacedBy(World w, int p1, int p2, int p3, EntityLivingBase e, ItemStack i) { facing = determineOrientation(w, p1, p2, p3, e); w.setBlockMetadataWithNotify(p1, p2, p3, facing, 2); System.out.println(w.getBlockMetadata(p1, p2, p3)); x = p1; y = p2; z = p3; this.w = w; } @Override public IIcon getIcon(int side, int meta){ if(meta == 2){ if(side == 0) return bottom; if(side == 1) return top; if(side == 2) return front; if(side == 3) return back; if(side == 4) return right; if(side == 5) return left; } if(meta == 3){ if(side == 0) return bottom; if(side == 1) return top; if(side == 2) return back; if(side == 3) return front; if(side == 4) return left; if(side == 5) return right; } return blockIcon; } public static int determineOrientation(World par0World, int par1, int par2, int par3, EntityLivingBase par4EntityLivingBase) { if (MathHelper.abs((float)par4EntityLivingBase.posX - (float)par1) < 2.0F && MathHelper.abs((float)par4EntityLivingBase.posZ - (float)par3) < 2.0F) { double d0 = par4EntityLivingBase.posY + 1.82D - (double)par4EntityLivingBase.yOffset; /* if (d0 - (double)par2 > 2.0D) { return 1; } if ((double)par2 - d0 > 0.0D) { return 0; }*/ } int l = MathHelper.floor_double((double)(par4EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; return l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0))); } } Any help is appreciated, thanks.

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.