* 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.
This commit is contained in:
Jezza 2016-11-03 11:34:25 +01:00 committed by LexManos
parent dc871ea273
commit 5802a3b0b6
2 changed files with 6 additions and 1 deletions

View file

@ -26,6 +26,7 @@ import java.util.EnumMap;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import net.minecraft.util.IThreadListener;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
@ -104,6 +105,10 @@ import net.minecraftforge.fml.relauncher.Side;
* </pre> * </pre>
* </code> * </code>
* *
* 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 * @author cpw
* *

View file

@ -332,7 +332,7 @@ public class EntityRegistry
return er; return er;
} }
localClazz = localClazz.getSuperclass(); localClazz = localClazz.getSuperclass();
keepLooking = (!Object.class.equals(localClazz)); keepLooking &= (!Object.class.equals(localClazz));
} }
while (keepLooking); while (keepLooking);