From 5802a3b0b613635015e52bbb562795e479f0aa7f Mon Sep 17 00:00:00 2001 From: Jezza Date: Thu, 3 Nov 2016 11:34:25 +0100 Subject: [PATCH] Fixes #3237 and #2752. (#3347) * Fix #3237 by correctly utilising the keepLooking argument. * Explain within SimpleNetworkWrapper's javadoc that the execute of the handler isn't on the main Minecraft thread. --- .../fml/common/network/simpleimpl/SimpleNetworkWrapper.java | 5 +++++ .../minecraftforge/fml/common/registry/EntityRegistry.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java b/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java index de33d5c1e..21729f9e3 100644 --- a/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java +++ b/src/main/java/net/minecraftforge/fml/common/network/simpleimpl/SimpleNetworkWrapper.java @@ -26,6 +26,7 @@ import java.util.EnumMap; import com.google.common.base.Throwables; +import net.minecraft.util.IThreadListener; import org.apache.logging.log4j.Level; import io.netty.channel.ChannelHandler; @@ -104,6 +105,10 @@ import net.minecraftforge.fml.relauncher.Side; * * * + * Note: As of Minecraft 1.8 packets are by default handled on the network thread. + * That means that your {@link IMessageHandler} can not interact with most game objects directly. + * Minecraft provides a convenient way to make your code execute on the main thread instead using {@link IThreadListener#addScheduledTask(Runnable)}. + * The way to obtain an {@link IThreadListener} is using either the {@link net.minecraft.client.Minecraft} instance (client side) or a {@link net.minecraft.world.WorldServer} instance (server side). * * @author cpw * diff --git a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java index a7857293a..59a6f26c9 100644 --- a/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java +++ b/src/main/java/net/minecraftforge/fml/common/registry/EntityRegistry.java @@ -332,7 +332,7 @@ public class EntityRegistry return er; } localClazz = localClazz.getSuperclass(); - keepLooking = (!Object.class.equals(localClazz)); + keepLooking &= (!Object.class.equals(localClazz)); } while (keepLooking);