Jump to content

MineMaarten

Members
  • Posts

    169
  • Joined

  • Last visited

Everything posted by MineMaarten

  1. Magic that a basic Java developper knows about. That's probably why this topic is three pages long.
  2. Well, you need to check one step earlier: electrolysisItemStacks[6] is null at the start, so: if(electrolysisItemStacks[6] != null && electrolysisItemStacks[6].itemID == Elementum.upgradeSpeed.itemID){
  3. And you shouldn't put the ingredients in parenthesis quotes, so Item.stick rather than "Item.stick". //Edit: Tnx Draco, that English isn't my first language has been proven once again
  4. From Pahimars Let's Mod series, Dev environment 3.0 is the video you want to look for.
  5. forge will only send a gui packet when getServerGuiElement returns a Container.As you don't have a container the gui will be entirely client sided so you can call EntityPlayer#openGui from the client only, like Diesieben said.
  6. I don't think that is going to work, as the texture name is only being used at the initialization of the mod, when the IconRegister goes over all the registered blocks. Changing this String on the way doesn't have any effect.
  7. That is a good way to store the rotation. You now have the rotation stored in the metadata. But that alone doesn't do anything. You need to return different block face icons for different rotations. In your block, override public Icon getIcon(int side, int meta). As you see, you get exactly the parameters you need to achieve this.
  8. Creating your own events is very much possible. Some mods use this in their API's to allow other mods to do something when something in the mod happens (like when a reactor from IndustrialCraft 2 ticks). However if you want to add events for happenings in Vanilla Minecraft, you'll probably have to edit base classes, and then you have no purpose to add an event there, as their most important property is that it prevents modders from editing base classes.
  9. @Draco18s: 1) You can't retrieve TileEntities with World#getEntitiesWithinAABBxx(). These are only for entities that have Entity as their superclass. This isn't the case for TileEntities. 2) That's an other way to do it yes. looping through every position within the area and retrieving its TileEntity. Dependant on the size of the area one or the other is more efficient.
  10. To prevent other people from getting the same crash when they try to play your mod without having AE installed you can do AE specific things when Loader.isModLoaded("AEModID") equals true. However when you rely on AE you should add AE as a dependancy like mentioned by Chibill.
  11. The way to learn is to when you feel you're problem is about the understanding of Java, you look it up on google. Every problem I myself encountered so far related to basic Java I've found solved at stackoverflow.com. To help you with your problem, you're writing to WorldInfo right? http://www.minecraftforge.net/forum/index.php/topic,13558.msg69837.html#msg69837
  12. That's the one you need. Just do a setBlockBounds() call in there which says how you want the block to be orientated when being rendered as an item (BlockHalfSlab.java once again is a nice example).
  13. Lol! I was reinventing the wheel apparently...
  14. So you don't have to use a TileEntity now?
  15. Two things: 1. EntityPlayer#getCurrentArmor(0) returns the boots armor slot. You need EntityPlayer#getCurrentArmor(3). 2. Basic Java . With '==' you're checking if the checked objects are the same. This never is the case. You need to do: ItemStack helmetStack = FMLClientHandler.instance().getClient().thePlayer.getCurrentArmor(3); //just a new variable because the if statement is getting long otherwise if(helmetStack != null && helmetStack.itemID == GoogleGlassesMod.GoogleGlassStack.itemID){ //render }
  16. You need to set the block bounds when the Block is asking for it, check out Vanilla's BlockHalfSlab for an example. In there you can see you need to override Block#setBlockBoundsBasedOnState, and Block#addCollisionBoxesToList to prevent entity collision problems.
  17. You'll automatically solve this when you check for the player wearing the helmet, because there's only a player object when you're in the world. So when player != null results in true you're in the world. Check out https://github.com/MineMaarten/Worms-Mod/blob/master/src/wormsmod/client/render/ProjectileChargeRenderer.java for an example . Minecraft#inGameHasFocus() returns true when you're not in the pause screen or other gui which is also a helpful method.
  18. You're rendering things. You need to do this every render tick. Thinking about this I can see two things: 1. You're listening for player ticks instead of render ticks. These are only ticked 20 times a second instead of FPS times (>20 times usually). 2. You're only calling the render method once. You need to draw POTATO every render tick. So no need for a variable to keep up if you already have rendered. Not creating a Minecraft instance! Getting the Minecraft instance (that's probably what you meant). This is only possible because you're working on the client side off course. So to get the player you can do FMLClientHandler.instance().getClient().thePlayer and go on from there to retrieve its helmet stack.
  19. That wasn't that necessary for now, I only mentioned it for completeness. But if you want to listen for Player ticks as well you can do this in your implementation of ITickHandler: @Override public EnumSet<TickType> ticks(){ return EnumSet.of(TickType.RENDER, TickType.PLAYER); } Because you only register it for the client you'll only get client sided player ticks (which is great).
  20. Here's your answer: http://www.minecraftforge.net/forum/index.php/topic,13504.msg69629.html#msg69629 You add checks in there so you only render stuff when the player has a certain helmet on. If you really want to do it clean and don't want to use too much computing resources of the rendering you can also listen for player ticks and only check in there if the helmet's on. However I don't think checking for a inventory item is that resource intensive.
  21. You were getting a NullPointerException right? You are getting this because when onBlockPlaced() is being called when the block isn't placed yet, it's getting called just before that. Therefore the TileEntity is still null when you retrieve it. Solution would be to override Block#onBlockPlacedBy() or Block#onPostBlockPlaced() instead and use World#setBlockMetadataWithNotify() to change the metadata how you want.
  22. There's no event for that. However you can poll if the player has a certain helmet every tick. when you have the player you can do EntityPlayer#getCurrentArmor(3) to get the currently worn helmet. To do things every tick implement ITickHandler, listen for Render ticks, and don't forget to register it. Now you can draw 2D objects every time you tick and have a certain helmet on.
  23. That, or you can find out how this method works and implement your own version if you don't want to rely on CodeChickenCore .
  24. Ah now that you say that I think I know what you're problem is! You're using the coordinates given in the TESR method, but these are not world coordinates, these are relative render coordinates and only tell you how much you need to translate the render matrix! TileEntityRenderer, line 157 this.renderTileEntityAt(par1TileEntity, (double)par1TileEntity.xCoord - staticPlayerX, (double)par1TileEntity.yCoord - staticPlayerY, (double)par1TileEntity.zCoord - staticPlayerZ, par2); So the solution is to use tileEntity.xCoord to get all the world coordinates.
×
×
  • Create New...

Important Information

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