O'Reilly logo

Minecraft Mods Programming Absolute Beginner’s Guide by Rogers Cadenhead

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

20. Take a Census of Mobs and Villages

In This Chapter

Find all living mobs in the game world

Store the mobs in a list data structure

Learn the type of each mob

Use a hash map to count mob types

Work with enum constants

Calculate the distance between two things in (x,y,z) space

Send a message to a player with a mod

A useful application of mods is to discover more about Minecraft in real time as the game is being played. This chapter’s mod takes a census of the mobs that are active in the world in the vicinity of the player.

Mobs are loaded and unloaded by the game as players explore the world. The world is divided into chunks that are 16 blocks long, 16 blocks wide, and 256 blocks deep. The chunks nearest the player are loaded ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required