Jump to content


Forge Modder
  • Posts

  • Joined

  • Last visited


  • Gender
  • Location
    In the attic.
  • Personal Text
    I make backpacks.

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Darkona's Achievements

Tree Puncher

Tree Puncher (2/8)



  1. That is an almost completely useless answer. See, the Ice code works on the side of the blocks. What he wants to do is on the side of the player, meaning it is the player (presumably while wearing something) who is going to be "slippery" (I'm assuming) Turns out that if you want to constantly change the block properties under you, you're only wasting your time. To answer the OP's question, look here: https://github.com/Darkona/AdventureBackpack2/blob/master/src/main/java/com/darkona/adventurebackpack/common/BackpackAbilities.java See the itemSlime method for a way to make it so the player is all slippery. Mind you, this method executes every tick and leaves blocks untouched. You can use something similar in an event handler, executing in every tick the player has boots with the enchantment or however you're handling the enchantment.
  2. onBlockActivated happens in both client and server, and also you should spawn the item only serverside
  3. This answer is applicable for 1.7.10 .json models are for 1.8 onwards (AFAIK) http://www.minecraftforge.net/wiki/Rendering_a_Techne_Model_as_a_Block Also, iChun made a mod called Tabula that is way better than Techne to make models.
  4. You need: 1- A model with the two cubes, one inside the other. 2- A texture file that includes the textture for both boxes- 3- A Tile Entity Special Renderer. 4- Your own rendering method (preferrably in the model itself), in wich you will first render the inside box, then call a blending function, and render the second, bigger cube. Example: smallBox.render(f5); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); bigBox.render(f5) GL11.glDisable(GL11.GL_BLEND); Blending enables alpha transparency, so by rendering the outer box second you already rendered the small inside and the second will be semi transparent.
  5. You can also use rand.getNextGaussian() to add some natural flavor to the motion.
  6. Yeah, my bad, i didn't see the second one. It appears to me that the tileentityrenderer won't work for the inventory you have to do the rendering yerself. You are looking for something along these lines. This is not actual code, you need to adapt it for your personal circumstances. public void renderItem(IItemRenderer.ItemRenderType type, ItemStack stack, Object... data) { ///blahblahblah get the texture get the model etc case INVENTORY: Minecraft.getMinecraft().renderEngine.bindTexture(modelTexture); { GL11.glPushMatrix(); GL11.glColor4f(1, 1, 1, 128); GL11.glPushMatrix(); GL11.glTranslatef(-0.5f, 0f, -0.5f); //This one is important because the model renders upside down because of reasons GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glPushMatrix(); GL11.glScalef(1.9f, 1.9f, 1.9f); model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.05F, other arguments, whatevers); GL11.glPopMatrix(); GL11.glPopMatrix(); GL11.glPopMatrix(); GL11.glPopMatrix(); } and for entity items case ENTITY: Minecraft.getMinecraft().renderEngine.bindTexture(modelTexture); { GL11.glPushMatrix(); GL11.glColor4f(1, 1, 1, 128); GL11.glPushMatrix(); GL11.glTranslatef(0f, 1f, 0f); GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glPushMatrix(); GL11.glScalef(1.2f, 1.2f, 1.2f); model.render(null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.05F, again some extra stuff if you want); GL11.glPopMatrix(); GL11.glPopMatrix(); GL11.glPopMatrix(); GL11.glPopMatrix(); }
  7. You are using it wrong. You should override the whole render code in IItemRenderer to render in the inventory, not use the tile entity renderer. Somewheree in your initialization you should have something like this: ClientRegistry.bindTileEntitySpecialRenderer(MyTileEntity.class, new MyTileEntityRenderer()); http://www.minecraftforge.net/wiki/Custom_Tile_Entity_Renderer
  8. Block public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { //This gets the direction the player is facing as an int from 0 to 3 int dir = MathHelper.floor_double((player.rotationYaw * 4F) / 360F + 0.5D) & 3; //You can use the block metadata to save the direction world.setBlockMetadataWithNotify(x, y, z, dir, 3); //Or you can save it in a tile entity if you are using one createNewTileEntity(world, world.getBlockMetadata(x, y, z)); } Custom Renderer //Stuff to get the dir int, from the block metadata or the tile or whatever //Check the dir and apply rotations if (dir == 0) { GL11.glRotatef(-180F, 0.0F, 1.0F, 0.0F); } if (dir % 2 != 0) { GL11.glRotatef(dir * (-90F), 0.0F, 1.0F, 0.0F); } if (dir % 2 == 0) { GL11.glRotatef(dir * (-180F), 0.0F, 1.0F, 0.0F); } This probably can be optimized a bit more, but this way its readable This is so commonly asked that it should be stickied somewhere ._.
  9. Call this.mc.getTextureManager().bindTexture(texture); again before drawing the second time and see if it works out. The drawString method rebinds to a different texture, and you are calling it between drawTexturedModalRect calls.
  10. what you are looking for are: - The different EntityAI classes. - the "tasks" and the "targetTasks" in EntityLiving You might have to end up adding your own custom AI by copying the herd AI from the pigman, adapt it for chickens and use an event to add it to them. If you want them to be able to attack you might have to change their Attributes as well to add attack damage, or you might have to make your own custom Entity and replace regular chickens with it. It's kinda complicated stuff for a begginer, and you'll have to learn to do a lot of things in the process.
  11. This is in the property class public static void syncToNear(EntityPlayer player) { if(player.worldObj instanceof WorldServer) { WorldServer world = (WorldServer)player.worldObj; SyncPropertiesPacket.Message msg = new SyncPropertiesPacket.Message(player.getEntityId(), get(player).getData()); world.getEntityTracker().func_151248_b(player, ModNetwork.net.getPacketFrom(msg)); } } And this is in the client side: public void synchronizePlayer(int id, NBTTagCompound properties) { Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(id); if(entity != null && entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)entity; if(BackpackProperty.get(player) == null) BackpackProperty.register(player); BackpackProperty.get(player).loadNBTData(properties); if(player == Minecraft.getMinecraft().thePlayer) { if (player.openContainer != null && player.openContainer instanceof IWearableContainer) { player.openContainer.detectAndSendChanges(); } } } } Works perfectly. Thanks so much, diesieben, you just saved me like 5 solid hours or more of messing around.
  12. public void func_151248_b(Entity p_151248_1_, Packet p_151248_2_) this expects a packet, and I assume I could use the old packet250custompayload for this. but a little down below there's this: public Set<net.minecraft.entity.player.EntityPlayer> getTrackingPlayers(Entity entity) which appears to return a set of the players tracking an entity. This looks like a better approach, considering I'm using the new networking wrapper thing. I'll test this out and if it doesn't work, packet250 it is (which I don't want to use since I'm sending an NBT and that would be a lot of refactoring)
  13. I get it, thanks diesieben. My only doubt is if the EntityID is the same for the server world and the client world. My guess is yes but I remember seeing somewhere else that there's a persistent ID, and then there's IDs. I'm coding your proposal at the moment to see how it goes anyway.
  14. Hello mates. I'm using IExtendedProperties to save information about a player. I use a custom player renderer to render a model on the player depending on the custom property. Synchronization between the server and the player works correctly, but the problem arises whn I want to render other players: they can't see the model. I realize that each client knows about its personal IExtendedProperties, but do not know about other client's. Any recommendation on an approach that would make all clients in rendering distance know that certain players have the property set? My current approach is sending packets to all players nearby each other every second or so, saving the data in a HashMap<UUID,NBTTagCompound> in the client proxy if the player != Minecraft...thePlayer, and when rendering doing a lookup in said HasMap based on the player's UUID. Is there something I'm missing that could make this easier?
  15. I agree is redundat, except in the rare case when you'd like other mods to notice that you used a hoe, for example. By the looks of it, though, he uses a custom hoe on a custom block, so it doesn't appear to be necessary at all.
  • Create New...

Important Information

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