Skip to Content
Minecraft Modding with Forge
book

Minecraft Modding with Forge

by Aditya Gupta, Arun Gupta
April 2015
Intermediate content levelIntermediate
200 pages
4h 17m
English
O'Reilly Media, Inc.
Content preview from Minecraft Modding with Forge

Chapter 5. Movement

Most entities in Minecraft—such as creepers, pigs, and zombies—move in the game. But they don’t have the capability to jump or get damaged when they fall. Also, none of the entities except spiders can climb up walls, and spiders can climb only up to three blocks high. In this chapter, you’ll learn how to change all this by modding the movement of the player.

First, you will make the player jump much higher; then you will add a parachute so that the player can avoid fall damage. Finally, you will make a mod that lets snow golems and iron golems climb up walls to reach hostile mobs that they can kill.

Super Jump

A Minecraft player can normally jump up to 1.252 blocks. This is typically done to jump over a block or get out of a cave. But what if you were to jump over a cliff that is much higher or a cave that is much deeper? This mod will give you the ability to jump much higher and reach new heights.

First, make a new class and call it SuperJump. Register it in the main file to activate the mod. The event handler method code that needs to be added to this class is shown in Example 5-1.

Example 5-1. Super jump method code
@SubscribeEvent
public void makeJumpHigher(LivingJumpEvent event){ 1
	if (!(event.entity instanceof EntityPlayer)) { 2
		return;
	}

	event.entity ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Minecraft Modding with Forge

Minecraft Modding with Forge

Aditya Gupta, Arun Gupta

Publisher Resources

ISBN: 9781491918883Errata Page