Jump to content

Naiten

Members
  • Posts

    325
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • URL
    http://www.planetminecraft.com/mod/162forgerails-of-war-embranchment-update/
  • Location
    Vladivostok, Russia
  • Personal Text
    Steam engine driver.

Naiten's Achievements

Diamond Finder

Diamond Finder (5/8)

20

Reputation

  1. Well, it was caused by Minecraft.getMinecraft() and some side restrictions not done.
  2. Well, is there any guide on doing that? 'Cause I've tried, and I'm getting tons of different errors every time.
  3. I guess ItemBlockWithMetadata will work better. Ugh. Wanted to get it without additional items...
  4. For some reason, my damaged block has same icons in inventory. Here's the code: public class BlockPointer extends BlockContainer{ @SideOnly(Side.CLIENT) private IIcon[] ico; public BlockPointer(Material material){ super(material); setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); setBlockName("row.blockPointer"); setCreativeTab(RoW.tabRoWEquip); } @Override @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list){ list.add(new ItemStack(item, 1, 0)); list.add(new ItemStack(item, 1, 1)); } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int p1, int p2){ return this.ico[p2 % 2]; } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_){ this.ico = new IIcon[2]; this.ico[0] = p_149651_1_.registerIcon("row:pointer"); this.ico[1] = p_149651_1_.registerIcon("row:pointer_mod"); } @Override public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4){ Block block = par1World.getBlock(par2, par3, par4); return (block == null || block.isReplaceable(par1World, par2, par3, par4)) && par1World.isSideSolid(par2, par3 - 1, par4, ForgeDirection.UP); } @Override public void breakBlock(World world, int i, int j, int k, Block p_149749_5_, int p_149749_6_){ world.removeTileEntity(i, j, k); } @Override public boolean renderAsNormalBlock(){ return false; } @Override public int getRenderType(){ return -1; } @Override public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l){ return false; } @Override public boolean isOpaqueCube(){ return false; } @Override public TileEntity createNewTileEntity(World world, int par2){ return new TileEntityPointer(); } } However, those items have different metadata and set it to blocks correctly.
  5. Well, as i've said, this part makes no sense for(int i = 0; i < 360; i++){ GL11.glRotatef(i, 0.0F, 0.0F, 1.0F); } In your RenderGrindstone the numbers of glPushMatrix(); and glPopMatrix(); are not mathcing, that may cause GL troubles. That's what I've seen. Sorry, but I have no time to check all your code.
  6. To rotate things properly you should model them so that their axles will go trough (0, 0, 0) point. Your blades are modeled wrong. And the whole code was written very poorly. Also, why are you binding texture after you render the top? However, i've made it work in some way. if (metadata > 7) { Minecraft.getMinecraft().renderEngine.bindTexture(textureWindTurbineTop); GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y - 0.5F, (float) z + 0.5F); this.modelTop.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); float time = 0; if(minecraft.theWorld != null) { time = (float)Minecraft.getMinecraft().theWorld.getWorldTime(); } float mult = 2F; //adjust this value to get the desired rotation speed GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 7.0F/16F, (float) z + 0.5F); GL11.glRotatef(time * mult, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0, -15.0F/16F, 0); this.modelTopBlade.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } } Still some weird black objects can be seen passing away sometimes.
  7. Well, providing the rest of your sources that are concerned with the block so that i can actually run the mod and debug it will be a good idea.
  8. Rotating should be done before rendering. Also, for(int i = 0; i < 360; i++) { GL11.glRotatef(i, 0.0F, 0.0F, 1.0F); } makes no sence. And, I think, it's good idea to use minecraft time to define the rotation angle. Try this: if (metadata > 7){ GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); this.modelTop.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); Minecraft.getMinecraft().renderEngine.bindTexture(textureWindTurbineTop); float time = 0; if(minecraft.theWorld != null){ time = (float)Minecraft.getMinecraft().theWorld.getWorldTime(); } float mult = 1F/12000F; //adjust this value to get the desired rotation speed GL11.glRotatef(time * mult, 0.0F, 0.0F, 1.0F); this.modelTopBlade.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }
  9. My way is next — put moving parts into separate model(s), and then use glRotate() and/or glRotate() when rendering the whole thing. As an example, here's my clock renderer: @SideOnly(Side.CLIENT) public class TileEntityRendererClockPole extends TileEntitySpecialRenderer{ protected ModelBase base = new ClockPoleBase(); protected ModelBase rim = new ClockPoleRim(); protected ModelBase hour = new ClockPoleHour(); protected ModelBase minute = new ClockPoleMinute(); @Override public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f){ GL11.glPushMatrix(); GL11.glTranslatef((float)d, (float)d1, (float)d2); TileEntityClockPole tile = (TileEntityClockPole)tileentity; if(tile != null){ renderBlock(tile, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, RoWBlocks.clockPole); } GL11.glPopMatrix(); } public void renderBlock(TileEntityClockPole tile, World world, int i, int j, int k, Block block){ Tessellator tessellator = Tessellator.instance; float f = block.getMixedBrightnessForBlock(world, i, j, k); int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int l1 = l % 65536; int l2 = l / 65536; tessellator.setColorOpaque_F(f, f, f); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2); if(tile != null){ Minecraft minecraft = Minecraft.getMinecraft(); float time = 0; if(minecraft.theWorld != null){ time = (float)minecraft.theWorld.getWorldTime(); } GL11.glPushMatrix(); GL11.glTranslatef(0.5F, 1.5F, 0.5F); if(world.getBlock(i, j - 1, k) instanceof BlockSlab) GL11.glTranslatef(0F, -0.5F, 0F); GL11.glScalef(-1.0F, -1.0F, 1.0F); GL11.glPushMatrix(); bindTexture(new ResourceLocation("row:textures/clock/pole/base.png")); base.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); bindTexture(new ResourceLocation("row:textures/clock/pole/rim.png")); GL11.glTranslatef(0.0F, -2.4375F, 0.0F); for(byte u = 0; u <= 3; u++){ GL11.glRotatef(u * 90F, 0.0F, 1.0F, 0.0F); rim.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPushMatrix(); GL11.glRotatef((time - 6000) / 11999F * 360F, 0.0F, 0.0F, 1.0F); hour.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glRotatef((time - 6000) / 11999F * 12F * 360F, 0.0F, 0.0F, 1.0F); minute.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glPopMatrix(); } } }
  10. Since we don't have item's ids one can't easily arrange items in the crative gui. Moving setCreativeTab() or registerItem() methods give no result. Any ideas on this?
  11. Well, I wanna try some ISBRH, but I don't want to write lines of code for every single vertex or remodel the whole thing in the Blender or something. Is there any utility that will convert mc models into .obj? Or is there a way to render techne model via tesselator?
  12. Firstly, theta = pitch (more exactly, 90 - pitch), phi = yaw. Can't immediately say how do you implement roll. Maybe i'll take a thought on it and give a solution. Rotations are in degrees, functions take radians, so you have to use Math.toRadians(angle).
×
×
  • Create New...

Important Information

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