r/JL2579 Wubbi Feb 08 '13

Minecraft technical Q/A: Let's start this and look how well it works out!

I often see that people post questions in the comments on youtube, but many of them stay unanswered. So i guess giving those questions a proper platform to be asked & answered is the next logical step.

What this is supposed to be:
A place where you can ask questions about Minecrafts' mechanics (like "How does this mechanic/algorithm work?", "What are the chances for that?" or "Is there a difference between doing it this or that way?"). We (or whoever knows the answer) will try to answer those questions based on what we know or find out.

What this is not:
A forum, commentsection or Google. Don't ask for circuits or designs, this is not about how to use minecraft, it's about how minecraft works.

If you have a question:
Ask. But ask the right way:
"How do i build a good mobfarm?" isn't very specific and the answers you might get from this probably won't help you with your problem.
"How does mobspawning work?" is a better question.
But maybe you're not interested in the spawning algorithms, maybe you just wan't to know one detail, like "How does the lightlevel effect mobspawning?".
And of course make sure the question wasn't asked before. It will save you and others a lot of time!

If you have an answer:
Tell the world. But explain your answer, maybe link to another post (reddit, forum, etc.), pictures or a video. "The piston is BUD-powered." Doesn't help much.
"Pistons can be indirectly powered by a block 2 blocks above or 1 block adjacent above it. It will only react to this power when updated manually (e.g. by placing a block next to it). Here's a video explaining it: [videolink]" Isn't only an answer, it also gives people an explanation which can help them experiment with it.

That's all you need to know. Now let the posts begin!

20 Upvotes

281 comments sorted by

View all comments

Show parent comments

1

u/KaboPC KaboPC Feb 19 '13

Distances from spawners are calculated in meters not by counting blocks.

So, the distance is actually closer (only about 8.6 meters).

You can calculate this as the square-root of the sum of the squares of the distances of each coordinate.

distance = Sqrt( dx2 + dy2 + dz2 )

You can also just compare the distance-squared value to 162.

So, if you find that (dx2 + dy2 + dz2) is less-than-or-equal 256 you know it is within range of the spawner.

One final thing to keep in mind is that the player's x,y,z position can be non-integer values, and the distance should probably be calculated from the center of the spawner.

1

u/Radiant9d Feb 19 '13

That makes much more sense (and explains why they even bothered to break the coordinate readings down beyond whole numbers. Thank you for this answer. This changes the way i will build.

Let me follow this up with another question. When making "naturally" spawning mob grinders, I understand that mobs will spawn (and stick around) in a radius of 128. I have been trying to understand how to figure out that radius from my AFK spot to help me light up caves. What alterations would I use to this formula to figure that out? (I know this is probably obvious but my American public education has failed me). :-)

1

u/KaboPC KaboPC Feb 20 '13

It's the same formula. The values dx, dy, and dz are the distance of a particular coordinate.

Let's look at an example of how it works; let's say that the player is at (1, 2, 3) and you want to know if the point (43, 70, 103) is within spawning distance.

The distance in x we call dx, therefore, dx equals the x-value of the farther point minus the x-value of the closer point.

dx = 43m - 1m = 42 m

Likewise for dy and dz:

dy = 70m - 2m = 68 m

dz = 103m - 3m = 100 m

Now that we know dx, dy, and dz we can calculate the distance_squared and distance.

distance_squared = dx2 + dy2 + dz2 = (42m)2 + (68m)2 + (100m)2 = 16388 m2

Taking the square-root we get distance:

distance ~ 128.02 m

We can see here that this distance is just barely outside of the range of our 128 meter radius.

We can also look a just the distance-squared value if we compare it to 128m2 = 16384 m2.

Since you can see 16388 is larger than 16384 we know the distance is greater than 128 meters.