Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by Naiten

  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).
  13. Well, this is my soapbox. Currently, I have system, that uses carrier's pos, yaw and pitch to determine connected entity position (so-called spheric coordinates). You can see the in one of my videos (see the player walking around the loco). Where you're gonna look for info is this http://en.wikipedia.org/wiki/Spherical_coordinate_system. If you still have troubles, I can take time and draw some explanations together with writing some code.
  14. So, GL11.glPushMatrix(); & GL11.glPopMatrix(); are not working from now?
  15. Why don't you just use GL11.glRotate(angle, 0F, 1F, 0F); ?
  16. First, take a look at this tutorial: http://www.minecraftforge.net/wiki/Netty_Packet_Handling Then, just copy AbstractPacket and PacketPipeline to your workspace. Register the Pipeline in your mod class. Next thing you gonna do is to create a class named, say, PacketMyThingy, and write the stuff you want to transfer. Here's and example of my class: package net.row.network; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import net.minecraft.entity.player.EntityPlayer; import net.row.stock.core.RoWSteamLocomotive; public class PacketLocomotive extends AbstractPacket{ byte reverse; boolean zeroReverse; boolean brake; byte hornStage; public PacketLocomotive(){ this.reverse = 0; this.zeroReverse = false; this.brake = false; this.hornStage = 0; } public PacketLocomotive(byte r, boolean z, boolean b, byte h){ reverse = r; zeroReverse = z; brake = b; hornStage = h; } @Override public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer){ buffer.writeByte(reverse); buffer.writeBoolean(zeroReverse); buffer.writeBoolean(brake); buffer.writeByte(hornStage); } @Override public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer){ reverse = buffer.readByte(); zeroReverse = buffer.readBoolean(); brake = buffer.readBoolean(); hornStage = buffer.readByte(); } @Override public void handleClientSide(EntityPlayer player){ } @Override public void handleServerSide(EntityPlayer player){ if(!player.worldObj.isRemote && player.ridingEntity != null && player.ridingEntity instanceof RoWSteamLocomotive){ RoWSteamLocomotive loco = (RoWSteamLocomotive)player.ridingEntity; loco.reverse = reverse; loco.zeroReverse = zeroReverse; loco.brake = brake; loco.hornStage = hornStage; } } } Then, go to your PacketPipeline.initialise() and a) rename the channel, b) register packet in such way registerPacket(PacketLocomotive.class); Finally, go to a place where you want to use a packet, and add line like this RoW.packetPipeline.sendToServer(new PacketLocomotive(loco.reverse, loco.zeroReverse, loco.brake, loco.hornStage)); As an instance, my key handler class: package net.row.handlers; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.row.RoW; import net.row.network.PacketLocomotive; import net.row.registry.RoWKeys; import net.row.stock.core.RoWSteamLocomotive; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.InputEvent; public class RoWKeyHandler{ @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event){ if(Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().thePlayer != null){ EntityPlayer player = Minecraft.getMinecraft().thePlayer; if(player.ridingEntity instanceof RoWSteamLocomotive){ RoWSteamLocomotive loco = (RoWSteamLocomotive)player.ridingEntity; if(RoWKeys.ReverseUp.getIsKeyPressed() && !loco.zeroReverse){ if(loco.reverse < 127 && !loco.zeroReverse){ loco.reverse += 1; } }else if(RoWKeys.ReverseDown.getIsKeyPressed() && !loco.zeroReverse){ if(loco.reverse > -127){ loco.reverse -= 1; } } if(RoWKeys.ReverseZero.isPressed()){ loco.zeroReverse = true; } if(RoWKeys.Brake.isPressed() && (loco.brakeStage == 0 || loco.brakeStage == 30)){ loco.brake = !loco.brake; } if(RoWKeys.Horn.isPressed() && loco.hornStage == 0){ loco.hornStage = 50; } RoW.packetPipeline.sendToServer(new PacketLocomotive(loco.reverse, loco.zeroReverse, loco.brake, loco.hornStage)); } } } } And the last thing - press „Thank you“ button if this was helpful.
  17. Try experimenting with this. protected void func_147906_a(Entity p_147906_1_, String p_147906_2_, double p_147906_3_, double p_147906_5_, double p_147906_7_, int p_147906_9_) { double d3 = p_147906_1_.getDistanceSqToEntity(this.renderManager.livingPlayer); if (d3 <= (double)(p_147906_9_ * p_147906_9_)) { FontRenderer fontrenderer = this.getFontRendererFromRenderManager(); float f = 1.6F; float f1 = 0.016666668F * f; GL11.glPushMatrix(); GL11.glTranslatef((float)p_147906_3_ + 0.0F, (float)p_147906_5_ + p_147906_1_.height + 0.5F, (float)p_147906_7_); GL11.glNormal3f(0.0F, 1.0F, 0.0F); GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); GL11.glScalef(-f1, -f1, f1); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); Tessellator tessellator = Tessellator.instance; byte b0 = 0; if (p_147906_2_.equals("deadmau5")) { b0 = -10; } GL11.glDisable(GL11.GL_TEXTURE_2D); tessellator.startDrawingQuads(); int j = fontrenderer.getStringWidth(p_147906_2_) / 2; tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F); tessellator.addVertex((double)(-j - 1), (double)(-1 + b0), 0.0D); tessellator.addVertex((double)(-j - 1), (double)(8 + b0), 0.0D); tessellator.addVertex((double)(j + 1), (double)(8 + b0), 0.0D); tessellator.addVertex((double)(j + 1), (double)(-1 + b0), 0.0D); tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, 553648127); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthMask(true); fontrenderer.drawString(p_147906_2_, -fontrenderer.getStringWidth(p_147906_2_) / 2, b0, -1); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glPopMatrix(); } }[/close]
  18. Yes, this is necroposting, but I still want to know dismount alternatives to «sneak» unmount.
  19. Go to net.minecraft.client.renderer.entity.Render class and look into renderLivingLabel() method. You can either call it, or copy and use in your render class.
  20. Where have you declared your flag? Try making it like that: Configloader public class YourConfig{ public YourConfig(){ } public static void initConfig(File f){ c = new Configuration(f); try{ c.load(); addItems = c.get("Misc", "Add items?", true).getBoolean(true); FMLCommonHandler.instance().getFMLLogger().log(Level.INFO, "[Yourmod] Done loading the config"); }catch(final Exception e){ FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, "[Yourmod] Error occured while loading the config"); }finally{ if(c.hasChanged()){ c.save(); } } } public static Configuration c; public static boolean addItems; } Place where you register items: final Item MyItem = new MyItem().setUnlocalizedName("MyItem").setTextureName(""); if(YourConfig.addItems){ GameRegistry.registerItem(MyItem, "MyItem"); }
  21. Well, actually, Netty is pretty simple. http://www.minecraftforge.net/wiki/Netty_Packet_Handling is much more better, than another tutorial.
  • Create New...

Important Information

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