Jump to content

jabelar

Members
  • Posts

    3266
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by jabelar

  1. I ran into the same problem recently. I was a bit surprised because I figured that if they exactly aligned that the render order would generally be constant, but someone else suggested roundoff error causes flickering on overlapping parts. One solution is to scale one part just slightly such that it doesn't seem obviously mismatched in size but the render is always properly ordered.
  2. Good clarification. You're right I used the word obfuscation loosely/erroneously. Basically it seems the OP wants source code (and yes of course that means both unobfuscated and decompiled). Didn't mean to question your tutorial, but a lot of us lesser modders do spend a lot of time looking at the source code so the decomp is important to us. For example, I found that the isClientWorld() method in EntityLivingBase returns true if it is NOT a client world -- if I hadn't inspected source I never would have figured out that problem. How do you get by with just the dev workspace?
  3. Like we said, you can increase the bounding box of the block so that it has an "invisible" portion above the block. This would affect all mobs. The problem is that it would affect the player too.
  4. Okay, I think you're right. I quickly followed the tutorial and it seems that it isn't using the latest naming or icon methods for the block example. For instance it uses the setUnlocalizedName() method, getIcon() methods, etc. You should look at the latest ways to do the above (set name and set textures) for blocks to fix this. I don't have time at the moment but will look into to it later this week. But for example, the setUnlocalizedName() should be changed to setBlockName(), the registerIcons() should be changed to registerBlockIcons(), various places where it calls Icon it should be IIcon, etc. Just follow through the various warnings in Eclipse and then check the super classes to see where the likely method intended is and override that. The errors about the world.getBlockMaterial(x, y, z).isLiquid() should be changed I think to world.getBlock(x, y, z).getMaterial().isLiquid(). But yeah there do seem to be numerous mistakes or out of date info in that tutorial...
  5. Jacob, the instruction that GoToLink and other posted above is correct. Don't use Lex's tutorial exactly because he sets up a dev workspace which doesn't have the unobfuscated files (he must be so good with Minecraft modding that he doesn't need to look at the code and can just use the methods as passed). Instead, if you use gradlew setupDecompWorkspace it will install all the unobfuscated java code for Minecraft. After that you need to run gradlew eclipse. Then in eclipse you need to point to the right workspace and import the example mod. After all that, it should work -- whether or not there is a "javadoc" Eclipse will give you information on the class or method you hover over, let you go to the declaration, find the call hierarchy etc. It should NOT complain about not having source attached.
  6. True it is way more elegant in this case, but the problem is that in general (as you know) you have to think carefully about this sort of thing since the moveFlying() method is called from other places and if a person not so confident in coding does this they might forget to handle the lava case or whatever that also calls the method. A surgical change of just the lines you know are "wrong" (in this case any checks of isAIEnabled) is a bit safer for a beginning coder. (Remember we're helping someone who couldn't figure out where to make the change on their own.) I admit in this case copying a large method for change of one line is not elegant though.
  7. Okay, I haven't tried this but I think it might work. First of all, the order they appear is the order they are added to the tab. The mistake most people make is thinking they have to set the creative tab at same time as they create or register the item and so end up with a order they don't like, but actually setting the creative tab is just a method that can be called at any time. So all you need to do set all the creative tabs in the order you want them. Note you can also delete items from the creative tabs, including (I think) the vanilla items and re-add them in different order like: Item.getItemByID(400).setCreativeTab(null); // should remove pumpkin_pie from the food creative tab
  8. To clarify CoolBoy's suggestion what you need to do is: 1) Set a boolean in response to the event, in the event handler method. b) in the regular renderer check that boolean and render accordingly. If you didn't already have a renderer then you need to create one. In other words, you don't call a render, rather you let the renderer be called naturally and check whether it should do something special. Other note: the rendering happens on the client side only, so the boolean has to be available on the client side. If that boolean is set on the server then you will need to sync the client somehow (with packet or similar).
  9. I'm just writing a tutorial on this, and it isn't really finished, but you might find it useful so far: http://jabelarminecraft.blogspot.com/p/custom-entity-ai.html
  10. When they are swimming, they call a method called moveFlying() ("flying" is used for both swimming and flying because it means gravity is active on entity) which is called by moveEntityWithHeading(). In that method it also checks for the isAIEnabled() so you have to override that one as well. This is what the current class looks like: So you need to override the whole method and change the line near the top where it checks if isAIEnabled(). Regarding the rest of your comments about AI, I'm in the process of writing a tutorial on it. There are a couple of tricks related to how you disable AI when other AI is running (the setMutexBits() method is used but it is a little tricky without explanation) as well as the priority order you have the task list.
  11. I've always used the new AI so never really looked at this before. However, looking at it quickly it seems that you probably need to look at overriding at the following: In your entity class, maybe Override the getAISpeed() method. In the EntityLivingBase class, the method is defined as: public float getAIMoveSpeed() { return this.isAIEnabled() ? this.landMovementFactor : 0.1F; } So just change that 0.1F to what you want. Not sure but that might do it.
  12. There are a few tutorials. They all do the same basic stuff, but they each break up the processing a little bit differently so I agree it can be confusing. What are you using the packets for? For Entities I came up with my own system which I find fairly easy to understand. I made a tutorial where I tried to explain a bit more (like you said the other tutorials are more like examples than explanations): http://jabelarminecraft.blogspot.com/p/packet-handling-for-minecraft-forge-172.html SanAndreasP has some good system, and so does CoolAlias. I think both have some tutorial/example code around that is worth checking out. You don't need to use my code, but hopefully my explanations help you understand the common points for all these approaches.
  13. Like diesieben07 mentions, obfuscation only really prevents people from casually copying your work, but dedicated effort can often still figure it out. So unless your mod is so good that you expect people to copy it in ways that you don't want, probably not worth the effort. However, obfuscation really just means "make it hard for human to read". You can actually manually obfuscate with just a couple hours work if you really wanted to: - delete all comments - find and replace all class, field and method names with something "random" That goes a long way to preventing someone quickly copying your code. The downside to this is that it takes a bit of time, and you'd have to do it every time you update your mod so you'd really only want to do it if your mod was finished and unlikely to need regular updates.
  14. Okay, do you really have to send a packet every tick? You said you want it to be smooth, so I'm assuming that means that fast action is required? And would player input be continuous (like keyboard controlling fast movement) or would it be occasionally (like firing or hitting buttons?). Because if it is more like a board game then you'd only have to send sync information when something changes or input is entered. Anyway, I don't think 10 player's worth of packets should be too onerous. It only gets bad when it multiplies up (like in my example where every player can see several entities). If it does become a problem, you should also look at your payload carefully. Do you really need to send 16 doubles every tick? Can you come up with a pseudo compression scheme? Or different packet types that handle the payload according to what is truly needed? Alternatively, you can try to offload some processing onto the clients -- like "tweening" the animation. For example, if the game allows for it the server can just say where something is moving to and then the client can process the steps in between.
  15. I'm not sure but I suspect the problem is that you're missing up single quote marks ' and double quote marks " If you use single quote mark, it means it is a character and double quote marks mean string. The error seems to do with you using the wrong one when the other is expected. At least that is my guess.
  16. Well the redstone implementation itself is an energy system so you can just look at the source code for how that is done, although there would be a lot of extra stuff in there that is very specific to redstone. I'm pretty sure some other mods are open source. Also, as mentioned, while it is fun to code stuff up on your own, there are options to make use of API that some others have already provided.
  17. Okay, I solved this. It wasn't my mod that was mis-matched, it was Forge itself. And I missed it because it was really close -- my server was 1073 and client was 1075. Getting them both to 1075 fixed the issue. Still makes me wonder what is sufficient for client and server to consider a mod matched though...if anyone knows I'd still be interested.
  18. I think you would just would intercept the player render event and do a GL scale of -1.0 on the x and y dimensions (but not z as that would also make it backwards). You might have to GL translate a bit too since most of the models aren't quite centered on their origin. Note I think you can search the source code for dinnerbone and such to see the code that is related to them.
  19. A related question: What is the actual process where server and client agree that the mods match to allow connection? What is it comparing?
  20. Okay, yeah that is what I figured -- you'd have to look for both. Diesenben07's idea is probably cleaner though -- check the environment so you don't even have to try the wrong thing. Diesieben07, thanks for clarifying. I guess it makes sense that MCP won't map strings.
  21. Okay, it sort of depends on exactly what you want to do. But generally you will make blocks that have TileEntities that will help manage the information related to the energy in the block. TileEntities can "look around" them for neighboring blocks with TileEntities. Basically you would write code that would look at each position around the TileEntity for others. This will allow you to control transmission of energy, activate machinery and such. So imagine it like this. You would create certain energy sources. Then you would create certain transmission blocks. The transmission blocks would have code that checks for neighboring energy sources, and if there is a source then the transmission block would get energized too. The transmission blocks would also look for neighboring transmission blocks that happen to be energized, and if there is a neighboring energized transmission block then it would be energized too. In this way you can have a chain of energy transmission. Lastly you would have machinery blocks that would activate if they have either an energy source or an engergized transmission block neighboring it. Basically each of these blocks would have a field that indicated isEnergized. And each block would just check around itself to see if it is able to get energy to energize. Make sense?
  22. I haven't done any reflection yet but was wondering about this topic -- doesn't MCP help map this even in the case of reflection? If not how do you manage the development environment versus the actual minecraft environment?
  23. Oh, you're confused on something that confused me when I first started. All the logic for changing the model should actually be in your model file and in the model file there is a method you override called render(). That render() method actually gets the entity passed to it. So don't do your logic in the render class, but instead do it in the render() method in your model class.
  24. In multiplayer would all the players be able to see it, or only visible to one player (like a HUD or something)? The reason I ask is that the data will have to be synced to all the clients so total bandwidth and processing would multiply up by the number of clients that might have the entity active in their client. Would there ever be lots of them in the game at the same time? This would also, of course, multiply up the amount of bandwidth and processing required. For example, if you had four of these that were visible to four players then you'd have 4 * 4 * 8 = 256 bytes of payload that have to be transferred every tick. However, I'm not really sure that that is that much of a problem with a modern computer but you can see how they could add up. I do think that for smoothness you would want to update every tick or at least every other tick. Every other tick would be a frame rate of 25 FPS which is pretty much considered low quality movement in modern gaming.
  25. Okay, so I have two computers with Minecraft and Forge 1.7.2 and related profiles set up in the launcher. I have my mod which I built and it works great in single player on both computers. I am logged into each with a different valid account (one is my daughter's). However, if I open to LAN in either direction the other computer can see the game but when it attempts to join it gets a "Mod Rejection" error. If I look at the console of the computer that had opened the game to LAN there is following error messages: I get same problem if I run server on one of the computers and also run client on same computer and connect to localhost. What am I doing wrong?
×
×
  • Create New...

Important Information

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