Errata

Minecraft Modding with Forge

Errata for Minecraft Modding with Forge

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 5
4th Paragraph

"... create a new directory on your desktop and call it forge. On Windows, this can be created by pressing the Ctrl and Esc keys together, which prings up a testbox where you can type any command that needs to run".


In that context, for Windows 8.0 and/or 8.1, the shortkeys to use
is Windows and R.


Kind regards,

Yves

Note from the Author or Editor:
Add the sentence "In that context, for Windows 8.0 and/or 8.1, the shortkeys to use is Windows and R." right after the quoted paragraph.

Yves Ludwig  Jul 26, 2015  Aug 28, 2015
Printed
Page 30
Zombie spawn

Two extra '' (single quotes) at the end of the zombie summon line.

Note from the Author or Editor:
On page 30, under the words "To spawn a zombie with diamond armor, use this command:", replace:

/summon Zombie ~ ~ ~{Equipment:[{},{id:diamond_boots},
{id:diamond_leggings},{id:diamond_chestplate},{id:diamond_helmet}]}''

with:

/summon Zombie ~ ~ ~ {Equipment:[{},{id:diamond_boots},
{id:diamond_leggings},{id:diamond_chestplate},{id:diamond_helmet}]}

Bryce Nesbitt  May 31, 2015  Aug 28, 2015
Printed
Page 35
Example 3-6 and 3-7 Diamond Ore Trap

In changeset https://github.com/MinecraftForge/MinecraftForge/commit/53659fca065a600470734d81a168fbdde6ec631a#diff-3168eef80c674ad5e4c39fe89d628362
the event, x, y and z parameters were removed from BreakEvent.


We hit this with the Diamond Ore Trap example.


---

Overall for the book a great addition would be "how to look up javadocs" and browse the latest source code.

Note from the Author or Editor:
In Example 3-6 and Example 3-7, replace:

event.world.createExplosion(null, <3>
event.x, event.y, event.z,
10, true);

with:

event.world.createExplosion(null, <3>
event.pos.getX(), event.pos.getY(),
event.pos.getZ(), 10, true);

Bryce C Nesbitt  May 31, 2015  Aug 28, 2015
Printed
Page 35
3-6, 3-7

Can not define event.block

if (event.block != Blocks.diamond_ore)

Eclipse error = "block cannot be resolved or is not a field"

What am I doing wrong?

Note from the Author or Editor:
The correct code is shown at:

https://github.com/AdityaGupta1/minecraft-modding-book/blob/master/src/main/java/org/devoxx4kids/forge/mods/DiamondOreTrap.java

Code in Example 3-6 and 3-7 need to be changed

Change the following line:

if (event.block != Blocks.diamond_ore)

with

if (event.state.getBlock() != Blocks.diamond_ore) {

Julian Smith  Jun 22, 2015  Aug 28, 2015
Printed
Page 54
Bullet 6

Bullet (6), describing isRemote, is difficult to understand. Perhaps more clearly:

(6)(7) The LivingdeathEvent will actually be called twice for each death. The first time through isRemote will be false for the client, and we need to spawn the creeper. We don't want to spawn a second creeper on the server side: when isRemote is true nothing happens.

This mod can be made faster by checking isRemote before the loop:
if (event.entity.worldObj.isRemote) {
return;
}

Note from the Author or Editor:
On page 54, change:

<6> This `if` statement checks if the world is remote (`isRemote`). Just like in the bigger TNT explosions mod, this is done so that the statement inside does not run twice. If this statement was not here, five regular creepers would spawn, but five creepers without AI would also spawn. If a mob does not have AI, it can’t move and can’t take any damage.

to:

<6> The `LivingDeathEvent` will actually be called twice for each death. The first time, in which `isRemote` is false, the creeper needs to be spawned. The second time, when `isRemote` is true, the creeper should not be spawned. This is because when `isRemote` is false, everything is happening on the client side. We want to spawn the creeper on the client, because if we spawn it on the server, it will have no AI, and will not move or take damage.

Bryce Nesbitt  Jun 04, 2015  Aug 28, 2015
Printed
Page 60
Coe sample for bouncy sponges

The BouncySponges example uses a method on World:

event.entity.worldObj.getBlock(int,int,int)

It looks like it needs to be changed to crate a BlockPos instead, as per the code in the GitHub repository

BlockPos pos = new BlockPos(event.entity.posX, event.entity.posY - 2,
event.entity.posZ);

if (event.entity.worldObj.getBlockState(pos).getBlock() != Blocks.sponge) {
return;
}

Note from the Author or Editor:
On page 60, change:

if (event.entity.worldObj.getBlock(
((int) Math.floor(event.entity.posX)),
((int) Math.floor(event.entity.posY)) - 2,
((int) Math.floor(event.entity.posZ))) != Blocks.sponge)

to:

BlockPos pos = new BlockPos(event.entity.posX, event.entity.posY - 1,
event.entity.posZ);

if (event.entity.worldObj.getBlockState(pos).getBlock() != Blocks.sponge) {
return;
}


After the line that says:

import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

add a line that says:

import net.minecraft.util.BlockPos;

This change also need to happen in Example 5-3, page 60 as well.

Alex Blewitt  Jun 10, 2015  Aug 28, 2015
Printed
Page 61
Parachute section

The third paragraph in Parachute says "First, make a new class and call it Parachutes" but the sample on page 63 indicates it should be called Parachute instead.

So the fix is Parachutes -> Parachute on p61.

Note from the Author or Editor:
On page 61, change:

First, make a new class and call it `Parachutes`.

to:

First, make a new class and call it `Parachute`.

Alex Blewitt  Jun 07, 2015  Aug 28, 2015
Printed
Page 61,63
Item #4

Item #4 says:
event.entity.motionY = -0.05;

Should be:
player.motionY = -0.05;



Note from the Author or Editor:
On page 61 and 63, update the code:

event.entity.motionY = -0.05;

with

player.motionY = -0.05;

Jaeyoung Martin  Jul 08, 2015  Aug 28, 2015
Printed
Page 66
Last paragraph in summary

The summary says that the || operator was introduced - but it also introduced the && operator as well (on p64 and p65).

Note from the Author or Editor:
On page 66, change:

The logical `or` operator, `||`, was also used in one of the mods.

to:

The logical operators `or` and `and`, `||`, and `&&`, were also used in some of the mods.

Alex Blewitt  Jun 07, 2015  Aug 28, 2015
Printed
Page 69, 77
Page 69: Example 6-4. Flaming pigs method code part 1; Page 77: Example 6-7. Block filler method code part 1

Both of the commands are missing the method "getName()" that is required by the interface ICommand. On page 69, after the constructor:

public FlamingPigs() {
aliases.add("flamingpigs");
aliases.add("fp");
}

add the following code:

@Override
public String getName() {
return null;
}

On page 77, after the constructor:

public BlockFillCommand() {
aliases.add("fillblocks");
aliases.add("fb");
}

add the following code:

@Override
public String getName() {
return null;
}

AdityaGupta1  Jul 30, 2015  Aug 28, 2015
Printed
Page 92-94
Example 7-3, method 2 ; Example 7-3, bullet 1, second paragraph ; Example 7-4, method 2

The method "onBlockActivated()" and everything in its scope in both of the examples needs to be changed to:

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!world.isRemote)
return false;
player.addChatMessage(new ChatComponentText(
EnumChatFormatting.DARK_PURPLE
+ "You have clicked on the majestic ENDERIUM BLOCK!!!!!"));
EntityEnderEye eye = new EntityEnderEye(world, pos.getX() + 0.5, pos.getY() + 1.5,
pos.getZ() + 0.5);
eye.motionY = 0.1;
world.spawnEntityInWorld(eye);
return true;
}

Paragraph 2 of bullet 1 of Example 7-3 should say:

It is called when the block is right-clicked. The return type is `boolean`, so it has to return `true` or `false`. There are eight parameters, but we will only be using numbers 1, 2, and 4. Number 1 is the world that the block is in, number 2 is the position of the block, and number 4 is the player who clicked the block.

Note from the Author or Editor:
Page 92:

Replace Example 7-3 with:

@Override <1>
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!world.isRemote) <2>
return false;
player.addChatMessage(new ChatComponentText(
EnumChatFormatting.DARK_PURPLE
+ "You have clicked on the majestic ENDERIUM BLOCK!!!!!")); <3>
EntityEnderEye eye = new EntityEnderEye(world, pos.getX() + 0.5, pos.getY() + 1.5,
pos.getZ() + 0.5); <4>
eye.motionY = 0.1; <5>
world.spawnEntityInWorld(eye); <6>
return true; <7>
}

Paragraph 2 of Callout 1 should be replaced with:

It is called when the block is right-clicked. The return type is `boolean`, so it has to return `true` or `false`. There are eight parameters, but we will only be using numbers 1, 2, and 4. Number 1 is the world that the block is in, number 2 is the position of the block, and number 4 is the player who clicked the block.

Page 93-94:

Replace Example 7-4, last method with:

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!world.isRemote)
return false;
player.addChatMessage(new ChatComponentText(
EnumChatFormatting.DARK_PURPLE
+ "You have clicked on the majestic ENDERIUM BLOCK!!!!!"));
EntityEnderEye eye = new EntityEnderEye(world, pos.getX() + 0.5, pos.getY() + 1.5,
pos.getZ() + 0.5);
eye.motionY = 0.1;
world.spawnEntityInWorld(eye);
return true;
}

AdityaGupta1  Apr 15, 2015  Aug 28, 2015
Printed
Page 98
Under the line starting with "Now, go into your main file,"

The second parameter in the "registerBlock()" method of "GameRegistry", which currently is "Ender Ingot", should be "enderIngot". Without this change, none of the item textures will work.

Note from the Author or Editor:
Page 98:

Change

GameRegistry.registerItem(enderIngot, "Ender Ingot");

to

GameRegistry.registerItem(enderIngot, "enderIngot");

AdityaGupta1  Apr 15, 2015  Aug 28, 2015
Printed
Page 98, 100, 102
The entire page for each one

On all three of the pages, replace anything that says "ingotEnder" with the text "enderIngot" so as to avoid the texture failing. Also, on page 98, replace:

enderIngot = new EnderIngot();
GameRegistry.registerItem(enderIngot, "Ender Ingot");

with:

enderIngot = new EnderIngot();
GameRegistry.registerItem(enderIngot, "enderIngot");

to make sure the en_US.lang file works.

AdityaGupta1  Jul 30, 2015  Aug 28, 2015
Printed
Page 118
Figure 9-10

The Figure 9-10 screenshot shows resources called ender_block.png and enter_ingot.png, but in the chapter and subsequent figures these have been renamed enterBlock.png and enderIngot.png. So the screenshot is out of date.

Plus the JRE System Library is 'jdk_1.8.0_11' in Figure 9-10 and [jre8] in 9-11.

Note from the Author or Editor:
Thanks for the errata!

Figure 9-10 needs to be replaced with https://www.dropbox.com/s/35bqou7rsnk7fto/Figure%209-10%20Updated.png?dl=0.

Alex Blewitt  Jun 07, 2015  Aug 28, 2015
Printed
Page 120
Example 9-11

In Example 9-11 in the code for the "ItemBlock model file text" the first line starting with "parent" is currently:

"parent": "mymods:block.enderBlock",

but on https://github.com/AdityaGupta1/minecraft-modding-book/blob/master/src/main/resources/assets/mymods/models/item/enderBlock.json

is seems that the line instead ought to be:

"parent": "mymods:block/enderBlock",

That means that the "." between "block" and "enderBlock" in the book should be an "/" instead. It seems that the block will not be rendered with the right texture, when shown in the inventory, if this error is not corrected in the JSON file

Note from the Author or Editor:
In the latest release of the book, in Example 9-11 (bottom of page 118), replace "mymods:block.enderBlock" with "mymods:block/enderBlock".

Nikolaj Lyngbye Kolbe  Nov 21, 2015 
999
First paragraph of "Adding the Event Handler" section in Chapter 2

Text says:

The Minecraft website includes a complete list of events for your reference.

That should be "the Minecraft Forge website".

I think it's important to be clear about the fact that there is no official support for modding from Mojang (now Microsoft).

Note from the Author or Editor:
Page 21, Adding the Event Handler section, End of 1st paragraph

The following text:

The Minecraft website includes a complete list of events

needs to be replaced with:

The Minecraft Forge website includes a complete list of events

Forrest Cahoon  Jul 03, 2015  Aug 28, 2015