Jump to content

jabelar

Members
  • Posts

    3266
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by jabelar

  1. Which line is 120 in your code? If you know that, then one of the things in that line must be null and you just need to think why it is null and fix that.
  2. By the way I have a tutorial on making version checking in your mod: seehttp://jabelarminecraft.blogspot.com/p/minecraft-forge-1721710-making-mod.html?m=1
  3. Just like in 1.7.10, there's an overload of setBlockState with and without the flags argument. That makes sense. Thanks for the confirmation.
  4. Is this going to happen in your own custom GUI? Or when player is wearing the armor in an armor slot? In the case of your own custom GUI, then I think you can do anything you want -- you could check the slots every tick, or you could maybe change the transferInSlot() method to do what you want. In the case where the armor is worn, you would just use the player tick event and check the player inventory for the armor slot positions. If you detect an item stack with an armor you're interested in, you can do what you want with it. If you want to add an effect to vanilla armor without using enchantements, I think this is the way to go.
  5. I think I ran into something like that when I was trying to generate some custom structures in-game. When there is world-gen happening, I don't think neighbors notify, but during the game they usually do. In 1.7.10 I think you can stop the notification with the "flag" parameter passed to the World#setBlock() method. The comment for that method says: * Sets the block ID and metadata at a given location. Args: X, Y, Z, new block ID, new metadata, flags. Flag 1 will * cause a block update. Flag 2 will send the change to clients (you almost always want this). Flag 4 prevents the * block from being re-rendered, if this is a client world. Flags can be added together. So I think you would use flag = 2. This won't update neighbors but will still update the client. I'm not sure how to do this in 1.8, as the World#setBlockState() method doesn't seem to have that flag anymore.
  6. Yes, attackEntityAsMob() is the right method. Instead of hardcoding the 12, it is preferable to look up the attribute you set for attack damage. But hardcoding should work. Isn't it working? If it isn't doing any damage, then there are usually three places to look: 1) make sure you've set the attackDamage attribute. It sounds like you've done that. 2) make sure you've overridden the attackEntityAsMob() method. It sounds like you've done that. 3) make sure the entity is actually colliding when attacking -- as mentioned above you might need to check out your AI for collisions.
  7. You have to be a bit careful though, because the scale will scale around the origin of entity model which happens to be at 1.5 blocks above the ground. If you just scale it bigger then the bottom of your entity will go into the ground, and if you just scale it smaller then the bottom of your entity will not touch the ground. So you need to translate the model, then scale it. I've worked out the formula. You just need to push a transformation matrix then translate and scale (and don't forget to pop the matrix at the end). So like this: public void render(Entity parEntity, float par2, float par3, float par4, float par5, float par6, float par7) { setRotationAngles(parEntity, par2, par3, par4, par5, par6, par7, parEntity); // scale the whole thing for big or small entities GL11.glPushMatrix(); GL11.glTranslatef(0F, 1.5F-1.5F*parEntity.getScaleFactor(), 0F); GL11.glScalef(parEntity.getScaleFactor(), parEntity.getScaleFactor(), parEntity.getScaleFactor()); myModel.render(par7); // don't forget to pop the matrix for overall scaling GL11.glPopMatrix(); } You would substitute your scale factor and model of course for you your entity.
  8. Okay, yeah the problem was I was forcing the motion to 0 so any pushing was being canceled. Instead I only set it to 0 at point when entity lands on ground, then afterwards allow it to be pushed with friction effect. SOLVED.
  9. I don't think it is normal behavior to be able to stand on top of an entity, right? Plus my custom entity can't be pushed out of the way. Now I thought the canBePushed() method was the one that controlled this. I overrode it to set it to true but still seems to have the same behavior. There is another method called canBeCollidedWith() but I think that also affects attacking and so don't think I should mess with that one, right? I crawled through the vanilla code and most living entities set the canBePushed() to return !this.isDead() so returning true should be fine for my purpose. What am I missing? In my entity I'm controlling the motion tightly, so I suspect that the problem is that when it tries to push me I'm overriding it with motion all 0. How would I let the motion from a push happen -- is there some sort of indication that it has been pushed? If there is no indication that it is in the middle of a push, I guess it must work with a "friction" sort of mechanism. I know that vanilla does that (always multiplies motion by something like 0.93 or something). So I guess maybe I need to implement that?
  10. Awesome. Always good to learn a new trick that is useful to the modding community.
  11. You shouldn't remove code from your post of your render class. There may still be some issue there (although I understand why you think there is not). Anyway, when people think that an entity is not rendering, it can actually be other problems: 1) maybe the entity is not spawning at all. Confirm that the constructor for your entity is being called (by using a System.out.println statement or similar) 2) maybe the entity is spawning but is spawning in position 0, 0, 0 or in some other position not near the player. In your entity's onUpdate() use System.out.println to output the entity position to the console. 3) Your texture mapping is off and so you're seeing through your entity due to transparent part of texture being mapped. I find it is a good idea to delete your texture asset while debugging entity rendering, then you'll get that pink and block checkered default pattern so you'll be sure to see it if it is there. Also not that when testing entity rendering it is a good idea to make the entity bounding box visible. You can do this by pressing F3+B.
  12. Well, maybe the "normal" will work as a wildcard. It is used for those JSON without properties, so maybe it can be combined with actual properties to provide the default.
  13. Why not think about this in 3D instead? Maybe you should do it as an entity render thing, draw the text oriented toward the camera (and possibly move the text towards the camera). Basically similar to the way names are displayed over entities/players. It really depends on the effect you're trying to get, but might work for you.
  14. How did you call the constructor of your block crop class? What did you pass into as the seed parameter?
  15. Really? You never click an item and put it in any of the other 30 some slots in your inventory? You always place it in your current slot? I don't think I ever put it in my current slot, as I'm usually already carrying something. Yeah, I guess I didn't mean held item, I meant what your mouse was moving (i.e. once you pick it up) but that isn't really in your inventory slot at that point so I guess you can't hook into that. I think ultimately it depends on how many recipes he wants to affect. Replacing them all might be a bit of work and may create some inter-mod compatibility issues. But it would be really easy if he just wants to do a couple. One other approach might be to intercept the interact event with the crafting table and bring up a custom gui associated with a custom container that gives the control you want.
  16. Did you look at my tutorial? Anyway, you can look at one of my implementations of a config GUI and GUI factory here: https://github.com/jabelar/MagicBeans-1.8fixed/tree/master/src/main/java/com/blogspot/jabelarminecraft/magicbeans/gui I only have a single category though. Like I said, I think the way to do multiple categories is to first come up with a regular GuiScreen that has buttons for each category, and have those buttons bring up the config GUI for that category. Understand what I mean?
  17. Even better you may not need to send anything in the payload at all. If the message is always meant to trigger a single action, just receiving the message should be enough for server. In such a case, the fromBytes() and toBytes() methods can be empty. Just need to put the code in the Handler part.
  18. 1.8 is the same as 1.7.10 for GUI stuff. Are you making a configuration GUI? I have a tutorial on that here: http://jabelarminecraft.blogspot.com/p/minecraft-modding-configuration-guis.html Regarding multiple config categories, I haven't tried that yet. If you want to use the built-in config gui screen, I think it is only one category per page. But one way you could do it is you could make the first page of the GUI actually just have buttons or menu of categories and have those bring up the category-specific pages.
  19. Well, the OP has to clarify, but it sounds like maybe he only wants to do it for a couple recipes, so just replacing those using diesieben07'2 method might be pretty easy. Since he said that it is okay for the player to be able to pick up the item but then it disappears, that means you can do one other approach. You could use the ItemCraftedEvent to set a boolean in an extended property for the player (that represents that the player picked up a restricted item), and then in the PlayerTickEvent check for that boolean and delete the itemstack that is being held. Since it would happen one tick later, I think it is safe to assume that the item in the hand is the one taken from the crafting, but to be really sure you could also have an extended property to indicate the itemstack. Yet another possible approach is to use a player tick handler and check if the crafting gui is open. If it is, I think you could monitor for something in the output slot and delete it. Of course the crafting matrix would continuously replenish it, but depending on the order of the tick events (probably need to play around with Post and Pre tick events to see which works better), it might work.
  20. No. You can still give the range. Have a min and max damage calculated. I kinda like the idea of the calculator and your design is nice. It's just that making it accurate will take a bit of detailed attention.
  21. Do you want the item to not even appear in the output, or you want it to be there but not able to pick up, or you want it to disappear when the certain player tries to pick it up?
  22. Oh, I see. You're making this calculator as a stand-alone application using some other programming language or tool? I thought you meant to make an in-game GUI that was a calculator. I guess one way to do it instead would be to trust the information on the various Minecraft wikis out there. Most of them seem to have information that people got directly from the code (like every item indicates the ID and such, which are from the code). So if you look up each entity, each weapon, each relevant potion (there are only a couple that would affect damage), there may be enough description there. So did you read pages like this one that explains damage: http://minecraft.gamepedia.com/Damage This one explains attributes and attribute modifiers: http://minecraft.gamepedia.com/Attribute#Attributes_available_on_all_living_entities This one explains enchantments: http://minecraft.gamepedia.com/Enchantments#Enchantments
  23. Yeah, I was going to mention that. Ernio's approach is something that was described by diesieben07 a while back. But I've never understood why you needed reflection because the Minecraft#getResourceManager() returns an the IResourceManager publicly and further has public methods for getting resources. But diesieben07 usually knows more than the rest of us combined, so there is probably a reason he suggested it his way.
  24. I don't think it is Mojang. I think it is the MCP mapping. Someone was going through the code and decided on a mapping name, the person who suggested it got it backwards. Now there are actual Mojang mistakes that can trip you up too. For example: The attackEntityAsMob() method is inherited from the EntityLivingBase class, however that class doesn't inflict any damage; rather it does nothing but update the last attacker, and in fact it seems to do this backwards (bug?). Let's look at that briefly, here is the code from the EntityLivingBase attackEntityAsMob() method: public boolean attackEntityAsMob(Entity par1Entity) { this.setLastAttacker(par1Entity); return false; } If you think about the logic in the above method, it seems to be backwards -- you are setting the last attacker of this which is the attacking entity to be the other entity. It seems it really should be instead: par1Entity.setLastAttacker(this). (However, it is possible that the method is misnamed or something, maybe it is meant to set the last attacked, but looking briefly through the method it seems to be named correctly.) It is further interesting that vanilla mobs (see EntityMob class or EntityWolf class) seem to fully override this method and don't call this as super method. So this bug won't afffect Vanilla Minecraft but could certainly affect you if you extend EntityLivngBase in your mod.
  25. I think you're asking about when there are multiple fields or methods with similar names that might make sense. Like in a block there are methods isNormalCube(), isOpaque(), isFullCube(), etc. which I always am unsure which does what. I use the Call Hierarchy tool a lot in Eclipse. Just highlight the field somewhere you've found it in the code base and then right-click and choose Call Hierarchy. It will show you what methods use that field. If you're still not sure you can expand those methods to see what calls them, and so forth. Also, in modding since the interfaces aren't documented I'd recommend to ALWAYS inspect the code of any method you call to confirm it is really the one you want to use because sometimes there are surprises or outright mistakes. For example, I got really screwed up using the isClientWorld() method in EntityLivingBase. If you look at the code for their method it is: /** * Returns whether the entity is in a local (client) world */ public boolean isClientWorld() { return !this.worldObj.isRemote; } You'll see this actually is BACKWARDS! It returns whether it is a server world, not a client world. You can imagine how hard it was to debug that and how screwed up my mod was with all the client and server logic reversed!
×
×
  • Create New...

Important Information

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