23

Yes, it generates more chunks (or at least more of the village tree) than you think it does. This is what I call "area of interest" in my voxel code. There are two kinds of area of interest: Logical (which is what we're discussing here) Rendering (which is typically be smaller in radius than the logical area) Remember that the only way your renderer can ...


16

What you need to do is separate terrain from live blocks. For example you could store the live blocks in a dictionary that uses a point as key. And then unload the terrain. This way your live blocks stay in memory in a way you see fit, and you can still look them up based on position, but the terrain is stored on disk for later retrieval. This will increase ...


15

Actually, Minecraft will run at whatever resolution you size your window to (348x866): So it's likely that whomever took the screenshot you grabbed, just happened to have their window sized that way. The default screen size when I start the game appears to be 856x482, which is pretty close to 16:9. It doesn't need to use a standard aspect ratio or ...


11

I saw a video from GDC where he said that he used Java because it's what he felt most productive in, at least at the time. It was only a passing comment though and note that this video is post-Minecraft, so his reasoning may not have been the same when he started Minecraft. Source: This video from about 14:45 in answer to the question "What Tools or ...


10

Yes, if you examine Minecraft under the hood you can see that it's just a separate file that will launch the JAR file afterwards. However, you're probably more interested in implementing an update solution for your game yourself. If that's the case, check out Sparkle.


9

You could look in the game code to find the code for enchanting. Since that takes away experience, it should tell you how, although it may be in levels. Also, you could look in the code for the anvil. In those, you should find variables for experience. You could probably subtract from those variables for every 2 or so blocks that you mine/dig/chop, like the ...


8

I'm going to assume you're using the Forge API, given the parameters you listed. EntityLiving is an abstract type representing living entities like players and mobs. When it is passed into your block break event, it indicates the entity which broke the block. It's not guaranteed to be a player, so you need to try to cast it to the subtype that represents a ...


8

This lag-vs-responsiveness issue is the situation with virtually all motion controllers, whether something like the Hydra, the Wii Remote, the Kinect, or the PlayStation Move. The problem is this: When an input stream is coming in, you're making a decision on a frame-by-frame basis about whether or not to trust the input data; whether the trends you're ...


8

Technical stuff During Minecraft's chunk generation a chunk passes several stages before it is done and can be rendered. These stages, in order, are as follows: EMPTY: Just as indicated, the chunk barely exists and is empty. STRUCTURE_STARTS: Here world generation decides whether a chunk might be the origin of a structure, and if so, it also generates the ...


7

I know there's an already accepted answer and it's not quite on the spot - but I also came here via Google and I was looking to learn and thought others might, too. There are other open-source Minecraft clones (and InfiniMiner which is what Minecraft is based off, too). I'd suggest anyone who is looking to study up on it looks at these: TechCraft ...


7

No. Notch said at some point that he plans to release the sources once the game is no longer selling, but that was WAY before it got this big. And yes, it's still selling.


7

There are two ways. Using MCP obfuscation mappings, the first and proper way to do so is with: EntityLiving.attackEntityFrom(DamageSource, damageDealt); You need to specify where the damage came from in the first parameter though, so the simpler one is to simply use: EntityLiving.setEntityHealth(health); Use this with getHealth so you can do stuff like ...


6

You can't just open the jar in Eclipse. Even if you have some kind of decompiler-plugin, you will only see obfuscated code. You will need the Minecraft Coder Pack to decompile and deobfuscate the jar (as well as MCP can anyway) so you can work with the code. Additionally, if you want do develop Minecraft-Forge mods you should check out this page. Forge ...


6

The bulk of Minecraft's chunk rendering goes through a vertex array. The world is split into 16x16x16-block render-chunks (which currently happen to be the same as storage-chunks, but it wasn't always that way). Each render-chunk is converted to a vertex array, and rendered. It uses OpenGL display lists (one per render-chunk) as an older alternative to VBOs....


5

There are many reasons why a game may be limited to a specific framerate, and only one of them is relative performance of the API version. Let's look at two of the most simple examples. vsync can limit framerate to the refresh rate of your monitor. If you have a 100hz monitor and if vsync is enabled, you'll never run faster than 100fps. The game may have ...


5

Most perlin noise algorithms will allow you to retrieve the noise value at any given location, with something like noise(x,y,z). This makes it fairly trivial to generate noise on a chunk by chunk basis. All you need to do is pass the global position, instead of the chunk position. for(int i = 0; i < CHUNKMAX_X; i++) for(int j = 0; j < CHUNKMAX_Y; ...


5

First, we need to identify the square consists 4 symmetric sides, each of them of length 2*r. 1 1 1 1 2 4 x x x 2 4 x C x 2 4 x x x 2 4 3 3 3 3 As you can see, the sides are symmetric relative to center, that means we can can take one cell from each side in each iteration, one coordinate always fixed while the other controlled by offset. To make it easier ...


4

You could try to accomplish it by looping through player's inventor and checking if Nth slot in his inventory is empty, if it isn't -- the function returns false. private boolean hasItems(ItemStack item) { for (int i=0; i<=thePlayer.inventory.getSizeInventory()-5; i++) { if (thePlayer.inventory.mainInventory[i].itemId != NULL) { ...


4

The main bottleneck is storing and generating chunks on the server. Around 10 Chunks in each direction are loaded for every player, that means that if a lot of players are in one spot, it's only going to load the chunks once, but if all players spread out, it's going to load these 10 chunks in each direction for every player. It gets even worse if the ...


4

A lot of people hate on Java, but honestly, modern Java is quite good. I mean, sure javac will never be as fast as a C/C++ compiler but if you take an in-depth look on how your Java code gets compiled into what eventually gets read by the JVM, you'll see why it's "slower." Regardless, Java is a powerful and straight-forward language and I could speculate ...


4

I think this is how it works in Minecraft. Each worm has a maximum length (let's call it M). The heads of each worm are calculated based on the chunk position. When you render each chunk, you have to check all chunks within an M radius, and follow all of their worms. It's not ideal in terms of performance, but it does work.


4

Backward compatibility is hard work. It really limits the architecture choices you can make. When you only have your application which doesn't need to interface with anything, and you decide that it's time to make everything different than you used to do it before, it's not a problem at all. But when you need to maintain compatibility with external ...


4

Tekkit (a popular minecraft mod) does this by allowing players to build anchors that keep a few blocks around them in memory regardless of player proximity. It might be a good choice if there is clear distinction between dynamic blocks that require the presence of the player (an automatic door) and others that don't (a generator of some sort). http://...


4

Learning to better help yourself is a wonderful thing, it helps you the most! With most things programming, doing a simple Google search first is typically the best route. Then there's the option of reading the documentation for the thing you're working on. Often they have helpful tutorials or manuals to help you. Once you find a good source for ...


4

That's usually just due to non-existent mipmapping. Turn it on.


3

Yeah, you should try to batch as much as possible, that is, combining the more cubes you can, in the least amount of vertex buffers you can. This is a good resource on the matter of Voxel Meshing. I recomend you to follow the culling algorithm, even older versions of minecraft used it and stood well at good framerates. To use more than one texture, you can ...


3

This is how I do it in my Minecraft clone: http://pastebin.com/10JH8HHF I apologize for the lack of comments in the source, however I will try to explain here: I will skip explanation of the Direct3D specific code - all it is doing is getting access to the texture data in memory. The function is called with one of the arguments a pointer to an array of ...


3

Using Existing Methods/Variables Since you are making a mod for Minecraft, and judging by the naming scheme of the methods you mentioned, I would suggest looking into the methods EntityRenderer.getMouseOver() and EntityLivingBase.rayTrace() (getMouseOver() uses it, and you can access the method by using mc.renderViewEntity.rayTrace()). Also mc....


Only top voted, non community-wiki answers of a minimum length are eligible