@Override protected void channelRead0(ChannelHandlerContext ctx, EntityMessage msg) throws Exception { if (msg.getClass().equals(FMLMessage.EntitySpawnMessage.class)) { spawnEntity((FMLMessage.EntitySpawnMessage)msg); } else if (msg.getClass().equals(FMLMessage.EntityAdjustMessage.class)) { adjustEntity((FMLMessage.EntityAdjustMessage)msg); } }
private void adjustEntity(EntityAdjustMessage msg) { Entity ent = FMLClientHandler.instance().getWorldClient().func_73045_a(msg.entityId); if (ent != null) { ent.field_70118_ct = msg.serverX; ent.field_70117_cu = msg.serverY; ent.field_70116_cv = msg.serverZ; } else { FMLLog.fine("Attempted to adjust the position of entity %d which is not present on the client", msg.entityId); } }
private void adjustEntity(EntityAdjustMessage msg) { Entity ent = FMLClientHandler.instance().getWorldClient().getEntityByID(msg.entityId); if (ent != null) { ent.serverPosX = msg.serverX; ent.serverPosY = msg.serverY; ent.serverPosZ = msg.serverZ; } else { FMLLog.fine("Attempted to adjust the position of entity %d which is not present on the client", msg.entityId); } }